(07AL) Programming Assignment 6 (PRE-FINAL BUILD) Students, For this programming assignment, take your updated (MIDTERM#2) Programming Assignment 4 : Part 2 (Only One Submission Allowed) . And, evolve...

1 answer below »
i need help with my assignment



(07AL) Programming Assignment 6 (PRE-FINAL BUILD) Students, For this programming assignment, take your updated (MIDTERM#2) Programming Assignment 4 : Part 2 (Only One Submission Allowed) . And, evolve your program through Chapter 6 and Chapter 7 topics. #1 New Package Create a new package in the same java project as your previous programming assignments such as “ (MIDTERM#2) Programming Assignment 4 : Part 2 (Only One Submission Allowed) “. The package should be called either, “com.preBuild.module7.RETAIL” “com.preBuild.module7.HEALTH” “com.preBuild.module7.ONLINE” “com.preBuild.module7.BANKING” https://eagleonline.hccs.edu/courses/154437/assignments/2839380 https://eagleonline.hccs.edu/courses/154437/assignments/2839380 #2 [RETAIL] New Classes : Class names & field names [RETAIL] variablename : dataType  Create the following classes in the new package (com.preBuild.module7.RETAIL) : 1. Person class -  create fields  personID:String  firstName:String  lastName:String  locationInfo:Location  create getters/setters, empty constructor, and constructor with fields. 2. Customer class –  create fields  personInfo:Person  product:Inventory  create getters/setters, empty constructor, and constructor with fields. 3. Location class –  create fields  streetAddress:String  city:String  tx:String  zipCode:int  create getters/setters, empty constructor, and constructor with fields. 4. Employee class –  create fields  personInfo:Person,  sellDate:String  position:String  productID:Inventory  create getters/setters, empty constructor, and constructor with fields. 5. Inventory class –  create fields  productID:String  productName:String  productQuantity:int  productCost:double  create getters/setters, empty constructor, and constructor with fields. [HEALTH] New Classes : Class names & field names [HEALTH] variablename : dataType  Create the following classes in the new package (com.preBuild.module7.HEALTH): 1. Person class-  create fields  personID:String  firstName:String  lastName:String  locationInfo:Location  create getters/setters, empty constructor, and constructor with fields. 2. Doctor class-  create fields  personInfo:Person  diagnosis:String  recordInfo:Record  create getters/setters, empty constructor, and constructor with fields. 3. Patient class-  create fields  personInfo:Person  isInsured:Boolean  visitDate:String  reasonInfo:Record  create getters/setters, empty constructor, and constructor with fields. 4. Location class-  create fields  streetAddress:String  city:String  tx:String  zipCode:int  create getters/setters, empty constructor, and constructor with fields. 5. Records class –  create fields  reasonForVisit:String  recordID:String  personID:Person  create getters/setters, empty constructor, and constructor with fields. [ONLINE] New Classes : Class names [ONLINE] fieldname : dataType  Create the following classes in the new package (com.preBuild.module7.ONLINE): 1. Person class-  create fields :  personID:String  firstName:String  lastName:String  locationInfo:Location  create getters/setters, empty constructor, and constructor with fields. 2. Customer class-  create fields :  personInfo:Person  isMember:Boolean  balance:double  transactionInfo:Transaction  create getters/setters, empty constructor, and constructor with fields. 3. Admin class-  create fields :  customerInfo:Customer  transactionInfo:Transaction  sessionID:String  create getters/setters, empty constructor, and constructor with fields. 4. Location class-  create fields :  streetAddress:String  city:String  tx:String  zipCode:int  create getters/setters, empty constructor, and constructor with fields. 5. Transaction class –  create fields :  serviceName:String  transactionID:String  transactionDate:String  serviceCost:double  create getters/setters, empty constructor, and constructor with fields. [BANKING] New Classes : Class names [BANKING] fieldname : dataType  Create the following classes in the new package (com.preBuild.module7.BANKING): 6. Person class-  create fields :  personID:String  firstName:String  lastName:String  locationInfo:Location  getters/setters, empty constructor, and constructor with fields. 7. Customer class-  create fields :  personInfo:Person  isMember:Boolean  balance:double  transactionInfo:Transaction  getters/setters, empty constructor, and constructor with fields. 8. Admin class-  create fields :  customerInfo:Customer  transactionInfo:Transaction  sessionID:String  getters/setters, empty constructor, and constructor with fields. 9. Location class-  create fields :  streetAddress:String  city:String  tx:String  zipCode:int  getters/setters, empty constructor, and constructor with fields. 10. Transaction class –  create fields :  serviceName:String  transactionID:String  transactionDate:String  serviceCost:double  getters/setters, empty constructor, and constructor with fields. #3 New Methods Create a class called “Mod7Main” in your old package, with the following functions [RETAIL] [HEALTH] [ONLINE] [BANKING] 1. Create function that ask the user a question-answer. • Enter 1 for the new methods or Enter 2 for the old program. • Relocate main method from old program to Mod7Main and change the old main method to a void method. Call the old – now void method if user enter 2. If Enter 1 the program should execute Mod7Main. 2. Create a function in Mod7Main, a method, that stores all fields’ data in an Object array per user. And the Object array’s elements or fields’ values are store in a text file in your program. 3. Create a function in Mod7Main, a method, that retrieves data, in an organized matter. All customer data should provide person data, and employee data should provide person data, as well. 4. Create a function in Mod7Main, a method, that finds a customer, or patient by a user entering the customers’ or patients’ personID from Person class. And the method will return Person data, Customer data, and some Transactional data such as transaction information of an event, record information of an event. Like a patient went to see a doctor, there should be information on why, what, happened when the patient went to the doctor’s office. New Old Program #4 Programming Assignment Specifications Topics Required Programming Assignment 4 : Improved and Updated, with Instructors recommendations from comments Chapter 6 _Classes and Objects ( Classes, Objects, Instance Fields, Methods, Constructors, Passing Object as Arguments, Overloading Methods and Constructors, Scope, package and import. Chapter 7 _ Array (processing array contents, passing arrays as arguments to methods, String Arrays, Arrays of Objects) #5 Programming Assignment Submission Zip the entire Java Project in compress zip file, and submit to assignment. (07AL) Programming Assignment 6 (PRE-FINAL BUILD) #1 #2 [RETAIL] New Classes : Class names & field names [HEALTH] New Classes : Class names & field names [ONLINE] New Classes : Class names [BANKING] New Classes : Class names #3 #4 #5
Answered 1 days AfterMay 04, 2021

Answer To: (07AL) Programming Assignment 6 (PRE-FINAL BUILD) Students, For this programming assignment, take...

Kshitij answered on May 06 2021
137 Votes
may05_21/one/Mod7Main.java
may05_21/one/Mod7Main.java
/*   Created by IntelliJ IDEA.
 *   Author: Kshitij Varshney (kshitijvarshne1)
 *   Date: 06-May-21
 *   Time: 4:07 PM
 *   File: Mod7Main.java
 */
package May.may05_21.one;
import May.may05_21.two.Banking.Transaction;
import May.may05_21.two.Retail.Customer;
import May.may05_21.two.Retail.Inventory;
import May.may05_21.two.Retail.Location;
import May.may05_21.two.Retail.Person;
import java.util.Scanner;
public class Mod7Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter 1 for new and 2 for old");
        int choice = sc.nextInt();
        if (choice == 1) {
            mod7Main();
        } else if (choice == 2) {
            RetailMain1.run();
        } else {
            System.out.println("wrong entry");
        }
    }
    private static void mod7Main() {
        Customer[] customers = new Customer[2];
        for (int i = 0; i < 2; i++) {
            customers[i] = new Customer(new Person(i + "2", "john", "Sue", new Location("Itly", "Yenn", i + i + i + "33", 33)), new Inventory("22" + i + i, "Phone", 10 + (i * 4), 900.0 + i * 8));
        }
        for (int i = 0; i < 2; i++) {
            System.out.println(c
ustomers[i].toString());
        }
        May.may05_21.two.Banking.Customer[] bCustomer = new May.may05_21.two.Banking.Customer[2];
        for (int i = 0; i < 2; i++) {
            bCustomer[i] = new May.may05_21.two.Banking.Customer(new May.may05_21.two.Banking.Person("2" + i, "sam", "john", new May.may05_21.two.Banking.Location("Itly", "Yenn", i + i + i + "33", 33)), true, 900.0 * (i + 1), new Transaction("k", "333", "2929298", 88.0));
        }
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter the Perosn id");
        String id = sc.next();
        for (int i = 0; i < 2; i++) {
            if (bCustomer[i].getPersonInfo().getPersonId().equalsIgnoreCase(id)) {
                System.out.println(bCustomer[i].toString());
                break;
            }
        }
    }
}
may05_21/one/output.txt
may05_21/one/RetailMain1.java
may05_21/one/RetailMain1.java
/*   Created by IntelliJ IDEA.
 *   Author: Kshitij Varshney (kshitijvarshne1)
 *   Date: 22-Apr-21
 *   Time: 9:05 PM
 *   File: RetailMain1.java
 */
package May.may05_21.one;
import javax.swing.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
public class RetailMain1 {
    /**
     * By the end of this program the customer should have already found the best pick for her special
     * occasion.
     */
    public static void run() {
        System.out.println("FDFD");
        /**
         * Author Mercedes Bautista
         * This program helps the customers find the perfect
         * dress for their special occasion and by entering their info they help us find
         * the right size for them. The program at the beginning it starts by giving information about the company
         * for example who is the owner, the year the company was found.
         * The target for this program is mainly the customers. But the program also will include special
         * deals for the employees just so they can also use the program.
         */
        String outFileName = "C:\\Users\\kshitij varshney\\IdeaProjects\\GreyNodes\\src\\May\\may05_21\\one\\output.txt";
        PrintWriter out = null;
        for (int i = 1; i <= 2; i++) {
            JOptionPane.showMessageDialog(null, i + " st time ", "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            try {
                out = new PrintWriter(new File(outFileName));
            } catch (FileNotFoundException e) {
                System.out.println("File not found");
            }
            JFrame jf1 = new JFrame();
            jf1.setAlwaysOnTop(true);
            String nameCo = "LoreZ"; // Company Name
            String myName = "Lorena Zepeda"; // Owner's name
            String myName2 = "Mercedes B"; // Owner's name
            JOptionPane.showMessageDialog(null, "About us" + "Name of company" + nameCo + " " + " " + "Founded by " + myName, "MESSAGE ", JOptionPane.PLAIN_MESSAGE);
            out.println("About us" + "Name of company" + nameCo + " " + " " + "Founded by " + myName);
            // Comparing Strings
            if (myName.compareTo(myName2) < 0) {
                JOptionPane.showMessageDialog(null, myName + " has less authority in the company than " + myName2, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            } else if (myName.compareTo(myName2) == 0) {
                JOptionPane.showMessageDialog(null, myName + "is equal to " + myName2, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            } else if (myName.compareTo(myName2) > 0) {
                JOptionPane.showMessageDialog(null, myName + "is greater than " + myName2, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            }
            String typeOfIndustry = "Retail"; // Type of Industry
            String typeOfIndustry2 = "Health"; // Type of Industry 2
            JOptionPane.showMessageDialog(null, "Type of Industry:" + typeOfIndustry, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            if (typeOfIndustry.equals(typeOfIndustry2)) // Comparing Industries
            {
                JOptionPane.showMessageDialog(null, "Industries are the same", "message", JOptionPane.PLAIN_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(null, "Industry Retail and Health are not the same", "Message", JOptionPane.PLAIN_MESSAGE);
            }
            final int yearFound = 1999; // Company was found
            JOptionPane.showMessageDialog(null, "What year was the company found?" + yearFound, "message", JOptionPane.PLAIN_MESSAGE);
            long numOfEmp = 100000; // Number of Employees
            JOptionPane.showMessageDialog(null, "Number of Employees:" + numOfEmp, "message", JOptionPane.PLAIN_MESSAGE);
            double empSalary = 20.99; // Employee Salary
            JOptionPane.showMessageDialog(null, "What is the salary for employees:$ " + empSalary, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            double discountPercent = 15.00; // Discount per employee
            JOptionPane.showMessageDialog(null, "Member Discount: $ %.2f\n" + discountPercent, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            JOptionPane.showMessageDialog(jf1, "Discount Percent per employee " + discountPercent + "%");
            char isHiring = 'Y'; // Company Hiring Status
            String myStr = String.valueOf(isHiring); // Convert char to String
            JOptionPane.showMessageDialog(null, "Is the company hiring? " + myStr, "MESSAGE", JOptionPane.PLAIN_MESSAGE); // Print string value
            boolean isMember = true; // Member Discount
            JOptionPane.showMessageDialog(null, "Membership Discount:" + isMember, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            int companyPay = 100000; // Company Penalties
            JOptionPane.showMessageDialog(null, "Company Penalties: $" + companyPay, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            long companyBenefit = 805000; // Company Benefits
            JOptionPane.showMessageDialog(null, "Company Benefits: $" + companyBenefit, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            float totalEmpSal; // Total Employee's Salary
            totalEmpSal = (float) (empSalary * numOfEmp); // Calculates Total Employees' Salary
            System.out.println("Total Employees' Salary: $" + totalEmpSal);
            final double companyCost; // Company Cost
            companyCost = totalEmpSal + companyPay; // Calculates Company Cost
            JOptionPane.showMessageDialog(null, "Company Cost: $" + companyCost, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            double netCost; // Net Cost
            netCost = companyCost - companyBenefit; // Calculates Net Cost
            JOptionPane.showMessageDialog(null, "Net Cost: $" + netCost, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            double netPerEmp; // Net Per Employee
            netPerEmp = netCost / numOfEmp; // Calculates Net per Employee
            System.out.println();
            JOptionPane.showInputDialog(null, "Net Cost per Employee: $" + netPerEmp, "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            int budget = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter your budget: ", "INPUT", JOptionPane.PLAIN_MESSAGE));
            JOptionPane.showMessageDialog(null, "The budget is " + budget, "Message", JOptionPane.PLAIN_MESSAGE);
            JOptionPane.showMessageDialog(jf1,
                    "At Lorez, we tried to find you the perfect dress for your special occasion, "
                            + "We're amazed you have picked us");
            String getDiscountStr; // Get the customer to decide if he/she wants a discount
            // Decision of customer regarding discount
            JOptionPane.showMessageDialog(null, "Do you want to get a discount by joining? (Enter yes or no)", "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            int count = 0;
            do {
                count++;
                getDiscountStr = JOptionPane.showInputDialog(null, "Enter next", "INPUT", JOptionPane.PLAIN_MESSAGE);
                if (!getDiscountStr.equalsIgnoreCase("yes") && !getDiscountStr.equalsIgnoreCase("no")) {
                    JOptionPane.showMessageDialog(null, "Enter yes or no", "INPUT", JOptionPane.PLAIN_MESSAGE);
                }
            } while (!getDiscountStr.equalsIgnoreCase("yes") && !getDiscountStr.equalsIgnoreCase("no") && count < 3);
            if (!getDiscountStr.equalsIgnoreCase("yes")) {
                JOptionPane.showMessageDialog(null, "Program exist due to wrong input", "MESSAGE", JOptionPane.PLAIN_MESSAGE);
                System.exit(1);
            }
            boolean getDiscount = getDiscountStr.equalsIgnoreCase("yes");
            count--;
            // Customers Phone Number
            String phoneNumber;
            if (getDiscount) {
                do {
                    phoneNumber = JOptionPane.showInputDialog(null, "Enter phone number", "INPUT", JOptionPane.PLAIN_MESSAGE);
                    if (phoneNumber == null || phoneNumber.trim().length() == 0) {
                        JOptionPane.showMessageDialog(null, "Enter valid phone number", "INPUT", JOptionPane.PLAIN_MESSAGE);
                    }
                } while (phoneNumber == null || phoneNumber.trim().length() == 0);
                // for
                // discount
                JOptionPane.showMessageDialog(jf1,
                        "Thank You, for entering your Phone Number. You get a 15% discount!!"); // Display Message
            }
            JOptionPane.showMessageDialog(null, "Enter the number of items you want to buy. Pick 1-3 to get an extra 5% off!!", "MESSAGE", JOptionPane.PLAIN_MESSAGE);
            int numberOfItems;
            do {
                numberOfItems = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter no of items", "INPUT", JOptionPane.PLAIN_MESSAGE));
                if (numberOfItems < 1 || numberOfItems > 3) {//number of items to buy should be at least 1
                    JOptionPane.showMessageDialog(null, "Number of items should be between 1 and 3", "MESSAGE", JOptionPane.PLAIN_MESSAGE);
                }
            } while (numberOfItems < 1 || numberOfItems > 3);
            int discountPercentage = 0;
            if (getDiscount) {
                switch (numberOfItems) // determine number picked by customer
                {
                    case 1:
                        JOptionPane.showMessageDialog(null, "You picked 2, you get an extra 5% off\"You picked 1, sorry you don't get a discount ", "MESSAGE", JOptionPane.PLAIN_MESSAGE);
                        discountPercentage = 0;
                        break;
                    case 2:
                        JOptionPane.showMessageDialog(null, "You picked 2, you get an extra 5% off", "MESSAGE", JOptionPane.PLAIN_MESSAGE);
                        discountPercentage = 5;
                        break;
                    case 3:
                        JOptionPane.showMessageDialog(null, "You picked 3, Surprise you get 10% off instead!!!!", "MESSAGE", JOptionPane.PLAIN_MESSAGE);
                        discountPercentage = 10;
                        break;
                    default:
                        break;
                }
            }
            //get the size of the customer
            int size = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter size ", "INPUT", JOptionPane.PLAIN_MESSAGE));
            int itemPrice = 0;
            //check if the size of greater than 10
            if (size > 10) {
                JOptionPane.showMessageDialog(jf1, ("Sorry we don't have that size for now. We're workin...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here