I need help with a Java computer science project.

In this project, you are going to create a simple order management system. The system can create new orders, show orders for a given customer, show the number of orders placed on a given date, return the order with the highest total price, and return the average total price for all orders.



Get Help With a similar task to - I need help with a Java computer science project.

Login to view and/or buy answers.. or post an answer
Additional Instructions:

089927044 Order Management System Project In this project, you are going to create a simple order management system. The system can create new orders, show orders for a given customer, show the number of orders placed on a given date, return the order with the highest total price, and return the average total price for all orders. The system interacts with the user via a menu-based system which is in the file OrderUserInterface which I am giving you. You will need to fill in a number of methods in OrderUserInterface. For example, you will need to write doDisplayOrdersForCustomer(), which prompts the user for the customer first and last name, reads in the information, and then displays all the orders for that customer. When the system starts up, it reads order information from a file called orders.txt. When a new order is created, the system also writes this information out to the file. You can see the code for reading and writing the file in load() and writeToFile(). You will also need to create a class called Order(named Order.java). This class should have the following instance variables: order number, customer first name, customer last name, item name, price, quantity ordered, total price, date order placed, estimated shipping date. The class should have a constructor with the following header public Order(String orderNum, String custFirstName, String custLastName, String itemName, double price,int quantity, LocalDate orderPlaced) The total price is not passed in as a parameter in the constructor. Instead, it should be set based on the item price and quantity ordered. The same is true for estimated shipping date. The estimated shipping date should be set to 2 weeks after the order date. You will also need a class called OrderManager. This class should have an instance variable which is an ArrayList of Order objects. It should have the following methods · public void addOrder(Order order) · public int countOrdersPlacedOnDate(LocalDate date) · public ArrayList<Order> findOrdersByCustomer(String fname, String lname) This method returns a list of orders for the customer. In it, you should create an empty array list, and then go through the existing orders one by one. If an order has the same customer first and last name, add it to the new array list. When all have been added, return the new array list. public Order findHighestValueOrder() This returns the order with the highest total value public double computeAverageTotal() Hand in the zipped project folder through Google Classroom. The grading will be based on the following working 60 · can add an order to the order manager · can count orders placed on a date · can display all orders placed by a customer · can find the order with the highest total · can compute the average of the order totals Design: 25 · correctly implements each of the methods in OrderManager and OrderUserInterface · separates functionality - user interaction in user interface class, managing the list of orders in OrderManager · correct visibility · method implementations are straightforward and do not unnecessarily repeat code Readability 15 · variable names · indentation · Javadoc comments orders.txt // do not include this line in .txt file 111A|Fred|Lee|tricycle|33.50|2|2020-02-15 112A|Fred|Lee|shovel|10.99|2|2020-03-15 113B|Angelo|Cardelli|mulch|13.99|2|2020-02-15 233M|Rashid|Jones|toothpaste|3.99|10|2020-03-12 113B|Rashid|Jones|mulch|13.99|20|2020-02-15 444B|Min|Chen|shrimp|8.99|5|2020-01-12 //OrderUserInterface.java import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.time.LocalDate; import java.util.ArrayList; import java.util.Scanner; public class OrderUserInterface { private Scanner in = new Scanner(System.in); private OrderManager orderMgr; /** * Create the user interface */ public OrderUserInterface(OrderManager mgr){ orderMgr = mgr; } /** * starts the system. This will cause a menu to be displayed. * Commands will be processed repeatedly until the user chooses * to stop by entering the relevant option (q) * @throws */ public void go() { load("orders.txt"); // reads from a file String cmd = doMenu(); while (!cmd.equals("q")){ doCommand(cmd); cmd = doMenu(); } System.out.println("Bye!"); } private void writeToFile(Order order, String filePath) { try { PrintWriter out = new PrintWriter(new FileWriter(filePath, true)); out.print('\n'); out.print(order.getOrderNum() + '|'); out.print(order.getCustFirstName() + '|'); out.print(order.getCustLastName() + '|'); out.print(order.getItemName() + '|'); out.print(order.getPrice()); out.print('|'); out.print(order.getQuantity()); out.print('|'); LocalDate orderPlaced = order.getOrderPlaced(); String dateStr = orderPlaced.toString(); out.print(dateStr); out.close(); } catch (IOException e) { e.printStackTrace(); } } private void doCommand(String cmd) { if (cmd.equals("a")) { doAddOrder(); } else if (cmd.equals("b")) { doDisplayNumOrdersPlacedOnDate(); } else if (cmd.equals("c")) { doDisplayOrdersForCustomer(); } else if (cmd.equals("d")) { doDisplayHighestValueCustomer(); } else if (cmd.contentEquals("e")) { doDisplayOrderAverage(); } else { System.out.println("Command was not understood, try again"); } } private void doAddOrder() { System.out.println("Enter the order number"); String orderNum = in.nextLine(); System.out.println("Enter the customer first name"); String fname = in.nextLine(); System.out.println("Enter the customer last name"); String lname = in.nextLine(); System.out.println("Enter the item name"); String itemName = in.nextLine(); System.out.println("Enter the item price"); String priceStr = in.nextLine(); double price = Double.parseDouble(priceStr); System.out.println("Enter the quantity"); String quantStr = in.nextLine(); int quantity = Integer.parseInt(quantStr); System.out.println("Enter the date in the format yyyy-mm-dd"); String dateStr = in.nextLine(); LocalDate orderDate = LocalDate.parse(dateStr); Order order = new Order(orderNum, fname, lname, itemName, price, quantity, orderDate); orderMgr.addOrder(order); writeToFile(order, "orders.txt"); } // Prints the menu and asks to enter a choice (by letters) returns the selection as a String private String doMenu() { //<To be done by you> } private void load(String filePath) { try { File file = new File(filePath); Scanner fileIn = new Scanner(file); while (fileIn.hasNextLine()) { String line = fileIn.nextLine(); Order order = readOrder(line); orderMgr.addOrder(order); } } catch (Exception e) { e.printStackTrace(); } } private Order readOrder(String line) { Scanner lineScanner = new Scanner(line); lineScanner.useDelimiter("\\|"); String orderNum = lineScanner.next(); String fname = lineScanner.next(); String lname = lineScanner.next(); String itemName = lineScanner.next(); String priceStr = lineScanner.next(); double price = Double.parseDouble(priceStr); String quantStr = lineScanner.next(); int quantity = Integer.parseInt(quantStr); String dateStr = lineScanner.next(); LocalDate orderDate = LocalDate.parse(dateStr); Order order = new Order(orderNum, fname, lname, itemName, price, quantity, orderDate); lineScanner.close(); return order; } } // OrderSystemStart.java // Runner public class OrderSystemStart { public static void main(String[] args) { OrderManager orderMgr = new OrderManager(); OrderUserInterface ui = new OrderUserInterface(orderMgr); ui.go(); } } Sample output of finished program Choose an option a: Add a new order b: Display the number of orders placed on a date c: Display orders for a customer d: display customer who placed highest value order e: display the average total price across orders q: quit Enter your choice b Enter the date you wish to view in the format yyyy-mm-dd 2020-02-15 The number of orders placed on 2020-02-15 is 3 Choose an option a: Add a new order b: Display the number of orders placed on a date c: Display orders for a customer d: display customer who placed highest value order e: display the average total price across orders q: quit Enter your choice c Enter customer last name Jones Enter customer first name Rashid order number 233M Name Rashid Jones Item toothpaste Price : 3.99 Quantity 10 Total price : 39.90 Date order placed 2020-03-12 Estimated ship date 2020-03-26 order number 113B Name Rashid Jones Item mulch Price : 13.99 Quantity 20 Total price : 279.80 Date order placed 2020-02-15 Estimated ship date 2020-02-29 Choose an option a: Add a new order b: Display the number of orders placed on a date c: Display orders for a customer d: display customer who placed highest value order e: display the average total price across orders q: quit Enter your choice a Enter the order number 444B Enter the customer first name Min Enter the customer last name Chen Enter the item name shrimp Enter the item price 8.99 Enter the quantity 5 Enter the date in the format yyyy-mm-dd 2020-01-12 Choose an option a: Add a new order b: Display the number of orders placed on a date c: Display orders for a customer d: display customer who placed highest value order e: display the average total price across orders q: quit Enter your choice c Enter customer last name Chen Enter customer first name Min order number 444B Name Min Chen Item shrimp Price : 8.99 Quantity 5 Total price : 44.95 Date order placed 2020-01-12 Estimated ship date 2020-01-26 Choose an option a: Add a new order b: Display the number of orders placed on a date c: Display orders for a customer d: display customer who placed highest value order e: display the average total price across orders q: quit Enter your choice d The customer who placed the order with the largest total is Rashid Jones placed on 2020-02-15 with a total priced of 279.8 Choose an option a: Add a new order b: Display the number of orders placed on a date c: Display orders for a customer d: display customer who placed highest value order e: display the average total price across orders q: quit Enter your choice e The average total for all orders is 80.27 Choose an option a: Add a new order b: Display the number of orders placed on a date c: Display orders for a customer d: display customer who placed highest value order e: display the average total price across orders q: quit Enter your choice z Command was not understood, try again Choose an option a: Add a new order b: Display the number of orders placed on a date c: Display orders for a customer d: display customer who placed highest value order e: display the average total price across orders q: quit Enter your choice q Bye!

Related Questions

Similar orders to I need help with a Java computer science project.
6
Views
0
Answers
Creating a DNS server (written in C)
WANT >=50% due to being swamped (only standard option minimal, don't care about cache or non-blocking). I require periodic updates of code with a description as there is a Git commit tracking. Also require a makefile according to the specifications and a g...
20
Views
0
Answers
Create inheritance project for a restaurant
Projects must include: -at least three different levels of inheritance - at least nine classes total -the highest superclass must have at least two methods -every subclass must contain a unique method that was not present in its super...
16
Views
0
Answers
Python Code for Suggesting Pets
Must have ___init___ ; ___str___ ; for loops ; while loops ; and must define a function which returns something, I wrote down what idea I had in that form so its best to follow it, this is an entry-level computer science project so it should be pretty easy...
23
Views
0
Answers
Quick HW Computer Science on LL(1) and object creation
Due at 12:00pm today. The question details are in the files attached. One question is on the impact of a parser being LL(1) or not. Another is on imagining a mistake in object creation. The answers are probably max 2 lines long....