CSE 110 Final Project CSE 110 Final Project: You are to create a Java Application that will outline everything you have learned this semester. This application is designed to display the following...

1 answer below »
Do my programming homework for me.



CSE 110 Final Project CSE 110 Final Project: You are to create a Java Application that will outline everything you have learned this semester. This application is designed to display the following skills: 1. Declaration of variables and data types 2. Creation of Classes and Methods and Encapsulation 3. Implementation of Constructors 4. Inheritance and Polymorphism 5. Reading and Writing to files For you project, you will be creating a online shopping application. There are 3 major parts to this project. 1. Manager – The manager has the following responsibilities: a. Enter items into storage/inventory. b. Modify items in storage/inventory. c. Delete items in storage/inventory. d. Add and remove employees e. Display all Employees. f. Modify Employees g. Also has the same abilities as the Employee 2. Employee – The Employee has the following responsibilities: a. Checkout Customer b. Check Inventory c. Review current online orders. d. Remove a customer’s order. e. Create customer account 3. Customer – The Customer has the following responsibilities: a. Load their order b. Save their order c. Checkout d. Create a new account e. Shop and search for items in the store. All data is to be saved in text documents: All Login should be stored in the following format: UserName, Password, type of account Example: SOsburn, 1234ASU, Manager Inventory should be stored in the following format: Product Name, Quantity, Price per unit Example: Sugar, 32, 2.35 Customer Information should be stored in the following format: First Name, Last Name, Street address, City, State, Zip, UserName Example: Steven, Osburn, 123 SunDevil Dr., Tempe, Az, 85232, sosburn Customer’s Order should be stored in the following format: Product, Quantity, Price per unit Example: Sugar, 2, 2.35 Apples, 2, .99 All customer orders are to be sorted (alphabetically) at the time of checkout and should be displayed in the following format: Customer: Steven Osburn 123 SunDevil Dr. Tempe, Az. 85232 Items to be purchased: 2 Apples $1.98 2 Sugar $4.70 ------------------------------------- Total: $6.68 Discounts: $0.00 Tax: 4% ------------------------------------- Total Purchase Price $6.94 During the execution of your application, you should be saving the customer data while shopping in an Array and then give the customer an option to: 1: Add more items 2: Review the list 3: Remove an item 4: Save List 5: Load List 6: Delete List 7: Completed Order 8: Exit Items 1 – 6 are self-explanatory, item 7 you will need to identify a way to separate the saved files from the completed ones. If the list is completed, it means that it is ready for check out and the employee or manager needs to be alerted when they log on. Employee’s and Manager Information should be stored in the following format: Employee ID, First Name, Last Name, Position, Login ID Example: 0001231, Steven, Osburn, Manager, sosburn During the login process, if it is an employee or manager, you must verify the user name from the login with the Employee’s and Manager Information file. Every customer can only save 1 file, if it exists, ask the customer if it’s ok to write over the current file. If they load the file, and want to Complete the Order, that file is deleted and a Completed Order file is created. You will need to verify with the customer to make sure they are completely done before you exit the customer. They might want to create a new order. Need to verify that there is enough inventory in-stock to sell. 1. Login as Customer 2. Login as Employee 3. Login as Manager 4. Exit 1 1. Load Data 2. Save Data 3. Checkout 4. Create account 5. Shop 6. Exit 5 1. Add item 2. Exit 1 Here is what we hava in stock: Product Name QuantityPrice Apple65.99 Oranges43.99 Tomato26.69 Steak226.55 M&M's85.69 What would you like to add to the cart? Please enter the name of the product: Apples Item is not found. Here is what we hava in stock: Product Name QuantityPrice Apple65.99 Oranges43.99 Tomato26.69 Steak226.55 M&M's85.69 What would you like to add to the cart? Please enter the name of the product: Apple How many Apple would you like? 3 The items were added to your cart. 1. Add item 2. Exit 1 Here is what we hava in stock: Product Name QuantityPrice Apple62.99 Oranges43.99 Tomato26.69 Steak226.55 M&M's85.69 What would you like to add to the cart? Please enter the name of the product: Steak How many Steak would you like? 3 The items were added to your cart. 1. Add item 2. Exit 1 Here is what we hava in stock: Product Name QuantityPrice Apple62.99 Oranges43.99 Tomato26.69 Steak196.55 M&M's85.69 What would you like to add to the cart? Please enter the name of the product: M&M's How many M&M's would you like? 3 The items were added to your cart. 1. Add item 2. Exit 2 1. Load Data 2. Save Data 3. Checkout 4. Create account 5. Shop 6. Exit 2 Please enter your fist initial + last name (ex. Steve Osburn = sosburn): sosburn 1. Load Data 2. Save Data 3. Checkout 4. Create account 5. Shop 6. Exit 1 Please enter your fist initial + last name (ex. Steve Osburn = sosburn): sdosburn There was no record found. 1. Load Data 2. Save Data 3. Checkout 4. Create account 5. Shop 6. Exit 1 Please enter your fist initial + last name (ex. Steve Osburn = sosburn): sosburn 1. Load Data 2. Save Data 3. Checkout 4. Create account 5. Shop 6. Exit 3 Do you already have an account (y/n)?y Please enter your first name: Steven Please enter your last name: Osburn Your order was processed. Customer: Steven Osburn 123 Apple ln. Mesa, Az 85212 Items to be purchased: No. ItemPrice 3Apple$2.97 3Steak$19.65 3M&M's$2.07 ------------------------------------- Total:$24.69 Discount:$0.00 Tax: 4% ------------------------------------- Total Purchase Price :$25.68 1. Load Data 2. Save Data 3. Checkout 4. Create account 5. Shop 6. Exit 6 1. Login as Customer 2. Login as Employee 3. Login as Manager 4. Exit 2 Please enter your username:bsmith Please enter your password:1234 1. Checkout Customer 2. Check Inventory 3. Review current online orders. 4. Review a customer’s order. 5. Delete a customer’s order. 6. Create customer account 7. Exit 2 Which Product do you want to check? Please enter Product Name: Apple Name: AppleNumber in Stock: 62Price Per Unit: .99 1. Checkout Customer 2. Check Inventory 3. Review current online orders. 4. Review a customer’s order. 5. Delete a customer’s order. 6. Create customer account 7. Exit 3 found COMP-sosburn.txt 1. Checkout Customer 2. Check Inventory 3. Review current online orders. 4. Review a customer’s order. 5. Delete a customer’s order. 6. Create customer account 7. Exit 4 Please enter File name to review: COMP-sosburn.txt Product Name QuantityPrice Apple3.99 Steak36.55 M&M's3.69 1. Checkout Customer 2. Check Inventory 3. Review current online orders. 4. Review a customer’s order. 5. Delete a customer’s order. 6. Create customer account 7. Exit 5 Enter the name of the file to be DELETED: COMP-sosburn.txt Your order was processed. 1. Checkout Customer 2. Check Inventory 3. Review current online orders. 4. Review a customer’s order. 5. Delete a customer’s order. 6. Create customer account 7. Exit 6 Please enter your First Name: Mike Please enter your Last Name: Osburn Please enter your Address: 123 Elm St. Please enter your City: Crazy Villa Please enter your State: Az. Please enter your Zip: 85643 1. Checkout Customer 2. Check Inventory 3. Review current online orders. 4. Review a customer’s order. 5. Delete a customer’s order. 6. Create customer account 7. Exit 7 1. Login as Customer 2. Login as Employee 3. Login as Manager 4. Exit 3 Please enter your username:sosburn Please enter your password:1234 1. Enter items into storage/inventory. 2. Modify items in storage/inventory. 3. Delete items in storage/inventory. 4. Add employees 5. Remove employees 6. Display all Employees. 7. Modify Employees 8. Checkout Customer 9. Check Inventory 10. Review current online orders. 11. Review a customer’s order. 12. Remove a customer’s order. 13. Create customer account 14. To Exit 1 Enter the item name: Fish Enter the number of items: 43 Enter the base price per unit: 1.99 1. Enter items into storage/inventory. 2. Modify items in storage/inventory. 3. Delete items in storage/inventory. 4. Add employees 5. Remove employees 6. Display all Employees. 7. Modify Employees 8. Checkout Customer 9. Check Inventory 10. Review current online orders. 11. Review a customer’s order. 12. Remove a customer’s order. 13. Create customer account 14. To Exit 2 What item would you like to modify: Apples Sorry, we didn't find that item. 1. Enter items into storage/inventory. 2. Modify items in storage/inventory. 3. Delete items in storage/inventory. 4. Add employees 5. Remove employees 6. Display all Employees. 7. Modify Employees 8. Checkout Customer 9. Check Inventory 10. Review current online orders. 11. Review a customer’s order. 12. Remove a customer’s order. 13. Create customer account 14. To Exit 2 What item would you like to modify: Apple 1. Modify Product Name 2. Modify Quantity 3. Modify Price per Quantity 4
Answered Same DayMay 08, 2021

Answer To: CSE 110 Final Project CSE 110 Final Project: You are to create a Java Application that will outline...

Valupadasu answered on May 09 2021
140 Votes
Shopping App/.idea/codeStyles/codeStyleConfig.xml




Shopping App/.idea/description.html
Simple Java application that includes a class with main() method
Shopping App/.idea/encodings.xml




Shopping App/.idea/misc.xml










Shopping App/.idea/modules.xml






Shopping App/.idea/project-template.xml

IJ_BASE_PACKAGE
Shopping App/.idea/workspace.xml


















































1588952073185


1588952073185

































Shopping App/out/production/Shopping App/COMP-rajeshv.txt
Shopping App/out/production/Shopping App/COMPrajv.txt
Shopping App/out/production/Shopping App/COMP-rajv.txt
Shopping App/out/production/Shopping App/COMP-testv.txt
Shopping App/out/production/Shopping App/Customer.class

public synchronized class Customer {
private String firstName;
private String lastName;
private int quantity;
private String item;
private double price;
private java.util.List listCustomers;
public String getFirstName();
public void setFirstName(String);
public String getLastName();
public void setLastName(String);
public int getQuantity();
public void setQuantity(int);
public String getItem();
public void setItem(String);
public double getPrice();
public void setPrice(double);
public java.util.List getListCustomers();
public void setListCustomers(java.util.List);
void Customer(String, int, double);
public void addProduct(java.util.List) throws java.io.IOException;
public void showOptions();
public void Customer();
}
Shopping App/out/production/Shopping App/CustomerInfo.txt
Shopping App/out/production/Shopping App/EmpData.txt
Shopping App/out/production/Shopping App/EmpLogin.txt
raj,raj1,Managerrajesh,test,Manageraj,test,Manager
raj2,test,Manager
Shopping App/out/production/Shopping App/Employee$1.class
synchronized class Employee$1 implements java.io.FilenameFilter {
void Employee$1(Employee);
public boolean accept(java.io.File, String);
}
Shopping App/out/production/Shopping App/Employee.class
public synchronized class Employee {
public void loadOptions() throws java.io.IOException;
public void Employee() throws java.io.IOException;
}
Shopping App/out/production/Shopping App/Inventory.txt
Shopping App/out/production/Shopping App/Main.class
public synchronized class Main {
public void Main();
public static void provideOptions();
public static void provideManagerOptions();
public static void main(String[]);
}
Shopping App/out/production/Shopping App/Manager$1.class
synchronized class Manager$1 implements java.io.FilenameFilter {
void Manager$1(Manager);
public boolean accept(java.io.File, String);
}
Shopping App/out/production/Shopping App/Manager.class
public synchronized class Manager {
public String modifyProduct(String);
public String modifyEmployee(String);
public void provideOptions();
public void Manager() throws java.io.IOException;
}
Shopping App/out/production/Shopping App/rajv.txt
Shopping App/Shopping App.iml









Shopping App/src/Customer.java
Shopping App/src/Customer.java
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class Customer {
    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public String getLastName() {
        return lastName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    private String firstName;
    private String lastName;
    public int getQuantity() {
        return quantity;
    }
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
    public String getItem() {
        return item;
    }
    public void setItem(String item) {
        this.item = item;
    }
    public double getPrice() {
        return price;
    }
    public void setPrice(double price) {
        this.price = price;
    }
    private int quantity;
    private String item;
    private double price;
    public List getListCustomers() {
        return listCustomers;
    }
    public void setListCustomers(List listCustomers) {
        this.listCustomers = listCustomers;
    }
    private List listCustomers = new ArrayList<>();
    Customer(String item,int quantity,double price){
        this.quantity = quantity;
        this.item = item;
        this.price = price;
    }
    public void addProduct(List list) throws IOException {
        Scanner sc = new Scanner(System.in);
        Scanner scnr = null;
        System.out.println("1. Add item");
        System.out.println("2. Exit");
        int option = sc.nextInt();
        List items = new ArrayList<>();
        if(option == 1){
            System.out.println("Here is what we have in stock:");
            System.out.println("Product Name"+"\t"+" Quantity"+"\t"+" Price");
            System.out.println("-------------------------------------");
            File inventory = new File("src/Inventory.txt");
            inventory.createNewFile(); // if file already exists will do nothing
            scnr = new Scanner(inventory);
            while(scnr.hasNextLine()){
                String line = scnr.nextLine();
                String tokens [] = line.split(",");
                items.add(line);
                System.out.println(tokens[0]+"\t"+tokens[1]+"\t"+tokens[2]);
            }
            System.out.println("-------------------------------------");
            System.out.println("What would you like to add to the cart?");
            System.out.println("Please enter the name of the product:");
            String product = sc.next();
            boolean found = false;
            int index = -1;
            String item ="";
            for(String itemName : items) {
                if (itemName.contains(product + ",")) {
                    item = itemName;
                    found = true;
                    break;
                }
            }
            if(!found) {
                System.out.println("item not found");
            }
                else{
                    System.out.println("How many Apple would you like?");
                    int count = sc.nextInt();
                    String tokens[] = item.split(",");
                    Customer customer = new Customer(tokens[0],count,count*Double.parseDouble(tokens[2]));
                    list.add(customer);
                    System.out.println("The items were added to your cart.");
                    addProduct(list);
                }
        }
        else{
            return;
        }
    }
    public void showOptions(){
        System.out.println("1: Add more items");
        System.out.println("2: Review the list");
        System.out.println("3: Remove an item");
        System.out.println("4: Save List");
        System.out.println("5: Load List");
        System.out.println("6: Delete List");
        System.out.println("7: Completed Order");
        System.out.println("8: Exit");
        Scanner sc = new Scanner(System.in);
        try {
            switch (sc.nextInt()) {
                case 1:
                    addProduct(listCustomers);
                    showOptions();
                    break;
                case 2:
                    System.out.println("Review the added items");
                    System.out.println("------------------------------");
                    for(Customer customer : getListCustomers()){
                        System.out.println(customer.getQuantity()+"\t"+customer.getItem()+"\t"+"$"+customer.getPrice());
                    }
                    System.out.println("------------------------------");
                    showOptions();
                    break;
                case 3:
                    System.out.println("Enter the item name to be removed");
                    String itemName = sc.next();
                    Customer tempCust = null;
                    for(Customer customer :listCustomers){
                        if(customer.getItem().equals(itemName)) {
                            tempCust = customer;
                            break;
                        }
                    }
                    listCustomers.remove(tempCust);
                    showOptions();
                    break;
                case 4:
                    System.out.println("Please enter your fist initial + last name (ex. Steve Osburn = sosburn): ");
                    String uName = sc.next();
                    File customerFile = new File("src/COMP-"+uName.toLowerCase()+".txt");
                    customerFile.createNewFile(); // if file already exists will do nothing
                    FileWriter wr = new FileWriter("src/COMP-"+uName.toLowerCase()+".txt",true);
                    for(Customer customer :getListCustomers()){
                        wr.write(customer.getItem()+"\t"+customer.getQuantity()+"\t"+customer.getPrice());
                    }
                    showOptions();
                    break;
                case 5:
                    System.out.println("Please enter your fist initial + last name (ex. Steve Osburn = sosburn): ");
                     String uName1 = sc.next();
                    File customerFile1 = new File("src/COMP-"+uName1.toLowerCase()+".txt");
                    customerFile1.createNewFile(); // if file already exists will do nothing
                    FileOutputStream oFile = new FileOutputStream(customerFile1, false);
                    Scanner scnr = new Scanner(customerFile1);
                    boolean found = false;
                    System.out.println("Customer order Info :");
                    while(scnr.hasNextLine()){
                        String line = scnr.nextLine();
                        String tokens [] = line.split(",");
                        if(tokens[0] != null){
                            found = true;
                            System.out.println(line);
                        }
                    }
                    if(!found){
                        System.out.println("There was no record found.");
                    }
                    showOptions();
                    break;
                case 6:
                    listCustomers.clear();
                    System.out.println("Customer order info cleared");
                    showOptions();
                    break;
                case 7:
                    System.out.println("Do you already have an account (y/n)?");
                    String res = sc.next();
                    if(res.toUpperCase().equals("Y")){
                        System.out.println("Please enter your first name: ");
                        String firstName = sc.next();
                        System.out.println("Please enter your last name: ");
                        String lastName = sc.next();
                        System.out.println("Your order was processed.");
                        System.out.println("Customer:"+firstName +" "+lastName);
                        System.out.println("Items to be purchased:");
                        System.out.println("No."+"\t"+"Item"+"\t"+"Price");
                        double totalPrice = 0;
                        listCustomers.sort(Comparator.comparing(Customer::getItem));
                        for(Customer customer : listCustomers){
                            totalPrice += customer.getPrice();
                            System.out.println(customer.getQuantity()+"\t"+customer.getItem()+"\t"+"$"+customer.getPrice());
                        }
                        System.out.println("------------------------------------");
                        System.out.println("Total: "+"\t\t\t"+"$"+totalPrice);
                        System.out.println("Disciunt: "+"\t\t\t"+"$"+0.00);
                        System.out.println("Tax: "+"\t\t\t"+"$"+"4%");
                        System.out.println("------------------------------------");
                        System.out.println("Total Purchase Price: "+"\t\t\t"+"$"+totalPrice+(totalPrice*4/100.0));
                    }
                    else{
                        System.out.println("Create account and proceed");
                    }
                    showOptions();
                    break;
                case 8:
                    break;
            }
        }catch (Exception e){
            System.out.println("Invalid input, please provide proper input");
            e.printStackTrace();
        }
    }
    public Customer(){
        showOptions();
    }
}
Shopping App/src/Employee.java
Shopping...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here