1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
solmaris [256]
3 years ago
5

Write the Java code to simulate an inventory control system and a point of sale system with customer history On program start, e

ach inventory item's data is read from the inventory file, placed in a new item class object, which is then placed in the inventory ArrayList. The ArrayList should be a field in the purchasing class (see below). The inventory data consists of the following fields. Only the last three data fields (ns listed here) should be modifiable after the object is created. A constructor will accept parameters for each of the fields, (a) The item's name (b) The item's.com (c) The current quantity of the item on-hand (d) The number of times the item has been purchased (e) The number of times the item hus been returned. After the inventory is processed, each existing customer's data is read from the customer file, pleced in a new item class object, which is then placed into the customer ArrayLut The ArrayList should be a local variable in the main method. The customer data consists of the following fields. All data in the customer clues should be modifiable based on the details given later. A constructor will accept parameters for each of the field (1) The customer's name (b) The customer's balance (positive balance indicates the customer has funda avul able to spend, and negative balance indicates the customer cwmoney) c) The customer's purchase history populated by a list of inventory item references from the inventory ArrayList. The history is stored in the customer file as a lint of inventory name along with the number of purchased items (d) The customer's shopping cart initially empty and not stored in the customer file. but alno populated by a list of inventory item references A purchasing class object contain the following methods for manipulating the ventory Armalist and a pied customer object. Each method will update the listed properti. A defnult constructor will create an instance of the inventory ArrayList and the value for a restocking for () Add an item to shopping cart (Inventory quantity customer shopping out) The castomer is pated with a lot of available items and more on selection. The men of ieme shown to the wet in generated from the ArrayList of kventory Item W Anong there is a lot one of item oond the item selected to "I decreased in the story Art The cutomer intend chose to not select an item to place in the Ert (6) Remove it from shopping cart (inventory: quantity, customer shopping Cart The customer in prented with the contents of the shoppies out it. The item selected is removed from the customer's eart ArrayList and the quantity on-band is increased in the inventory ArrayList. iii. The customer may instead choose to keep the contents of the cart. (e) Purchase items in a shopping cart (Inventory purchase count; enstomer balance, purchase history, shopping cart) 1. Print (to the terminal) a receipt listing the cart items. This includes the name and cont of ach item, plus the total cost of all items. If there are no items in the eart, it is not printed . Increase the purchase count of the items in the inventory ArrayList Deduct the shopping cart total from the customer's balance iv. Add the items to the customer's purchase history v. Empty the shopping cart ArrayList 1. Replace the data in the inventory file with the data currently in the in ventory ArrayList (te, the inventory file is updated so that it is correct) vil. Replace the data in the customer file with the data currently in the cu tomer ArrayList (le, the customer file is updated so that it is correct (d) Return an with restocking fee (ventory: quantity, return bout tomer balance purchase history) Print (to the terminal listing of the purch history. This includes the name and cost of each item. If there are no items in the purch history, alting is not printed Increase the return count of the selected items in the ventory Array i Mid the cost of the returned item to the customer's balance in testocking for iv. Remove the returned item from the customer's purchase history v. Replace the data in the inventory file with the data currently in the Inventory ArrayLin vi. Replace the data in the customer file with the data currently in the cus tomer ArrayList in the customer file is updated so that it is correct)
Computers and Technology
1 answer:
yuradex [85]3 years ago
7 0

Answer:

the code isnt complete but you get the idea ,just complete it. All the major method and classes have been written but go ahead and see if it works.Do consider giving brainliest if this ans helped you.

Explanation:

class InventoryItem

{

       private String name;

       private double cost;

       private int currqnt;

       private int itempur;

       private int itemret;

       InventoryItem(String name, double cost, int curr, int pur, int ret)

       {

               this.name=name;

               this.cost=cost;

               this.currqnt=curr;

               this.itempur=pur;

               this.itemret=ret;

       }

       public String getName()

       {

               return this.name;

       }

       public double getCost()

       {

               return this.cost;

       }

       public int getCurrQnt()

       {

               return this.currqnt;

       }

       public int getItemPur()

       {

               return this.itempur;

       }

       public int getItemRet()

       {

               return this.itemret;

       }

}

class Customer

{

       private String name;

       private double balance;

       private ArrayList<InventoryItem> purhist;

       private ArrayList<InventoryItem> cart;

       Customer(String name, double bal, ArrayList<InventoryItem> hist, ArrayList<InventoryItem> cart)

       {

               this.name=name;

               this.balance=bal;

               this.purhist=pur;

               this.cart=cart;

       }

       public String getName()

       {

               return this.name;

       }

       public double getBalance()

       {

               return this.balance;

       }

       public ArrayList<InventoryItem> getPurHist()

       {

               return this.purhist;

       }

       public ArrayList<InventoryItem> getCart()

       {

               return this.cart;

       }

       public void setPurHist(ArrayList<InventoryItem> it)

       {

               for(InventoryItem in: this.cart)

               {

                       this.purhist.add(in);

               }

               this.setCart(null,0);

       }

       public void setCart(ArrayList<InventoryItem> it,  int i)

       {

               if(it==null)

                       this.cart=null;

               int j=0;

               for(InventoryItem in: it)

               {

                       if(i==j)

                       {

                               if(this.getBalance()>=in.getCost())

                               {

                                       this.cart.add(in);

                               }

                       }

                       j++;

               }

       }

}

class Purchasing

{

       public void addItem(ArrayList<InventoryItem> it, Customer c)

       {

               System.out.println("inventory list is, x to leave");

               int i=0;

               for(InventoryList inv: it)

               {

                       System.out.println((i+1)+": "+inv.getName()+" "+inv.getCost()+" "+inv.getCurrQnt());

                       i++;

               }

               int choice = scr.nextInt();

               c.setCart(it, choice-1);

       }

       public void removeItem(ArrayList<InventoryItem> it, Customer c)

       {

               System.out.println("inventory list is, x to leave");

               int i=0;

               for(InventoryList inv: it)

               {

                       System.out.println((i+1)+": "+inv.getName()+" "+inv.getCost()+" "+inv.getCurrQnt());

                       i++;

               }

               int choice = scr.nextInt();

               it.remove(choice);

       }

       public void purchaseItem(InventoryItem it, Customer c)

       {

               c.setPurHist();

       }

       public void returnItem(InventoryItem it, Customer c)

       {

               System.out.println("purchase history list is, x to leave");

               int i=0;

               for(InventoryList inv: c.getPurHist())

               {

                       System.out.println((i+1)+": "+inv.getName()+" "+inv.getCost()+" "+inv.getCurrQnt());

                       i++;

               }

               int choice = scr.nextInt();

               c.getPurHist().remove(choice);

       }

       public static void main(String[] args)

       {

               Scanner scr=new Scanner(System.in);

               ArrayList<InventoryItem> inven = new ArrayList<InventoryItem>();

               ArrayList<Customer>L cust = new ArrayList<Customer>();

               System.out.println("Enter your name");

               String name=scr.nextLine();

               Customer obj=null;

               for(Customer c: cust)

               {

                       if(c.getName().equals(name))

                       {

                               obj = new Customer(c.getName(), c.getBalance(), c.getPurHist(), c.getCart());

                               break;

                       }

               }

               if(obj==null)

               {

                       obj = new Customer(name, 0.0, null, null);

               }

               System.out.println("Enter choice");

               System.out.println("a - add an item");

               System.out.println("b - remove an item");

               System.out.println("c - purchase items");

               System.out.println("d - return an item");

               char choice = scr.nextChar();

               switch(choice)

               {

                       case 'a':

                               addItem();

                               break;

                       case 'b':

                               removeItem();

                               break;

                       case 'c':

                               purchaseItem();

                               break;

                       case 'd':

                               returnItem();

                               break;

               }

       }

}

You might be interested in
During execution of main(), how many user-defined methods are called? a) public static double calcTax(double cost) { return cost
Dovator [93]

Answer:

b) public static double calcShippingCost(double weight) { double cost; if(weight < 10) { cost = 10.0; }else{ cost = 15.5; } cost = cost + calcTax(cost); return cost; }

The method is called twice with arguments 7.5 and 17.5 respectively.

Explanation:

The Java program defines three user methods including the main. In the main, the calShippingCost method is called twice with 7.5 and 17.5 respectively to return double number values to cost1 and cost2.

8 0
3 years ago
What is one reason why private loans are less favorable than federal loans?
Lilit [14]
The answer is higher interest rate
6 0
4 years ago
Read 2 more answers
What are the features of MS Excel​
Contact [7]
Then here are the excel features that you need to get a hold of:

Learn to use shortcuts. Once you are able to live without the mouse, you get the speed that counts. There are two types of shortcuts - one where you press a set of keys sequentially - like Alt>H>O>I to adjust column width. And the second where you simultaneously press a combination of keys - like Ctrl+Shift+L for applying filters or Ctrl+1 for the format numbers dialog box. It takes repetition to get the speed but once you are there, you get an edge.
Learn excel functions and apply them to build formulas. Start with easy ones like SUM, COUNT, SUMIF, COUNTIF, IF etc, then move to VLOOKUP, SUMIFS, COUNTIFS, HLOOKUP, INDEX, MATCH, then move to building nested complex formulas like IF inside an IF, VLOOKUP with HLOOKUP, INDEX+MATCH and so on.
Learn about data analysis and data aggregation. This includes tools like Pivot table, solver, goal seek, data tables, descriptive statistics, regression.
Learn about conditional formatting. Style and colour your spreadsheets.
3 0
3 years ago
Which of the acronyms listed below refers to a series of basic hardware diagnostic tests performed by the startup BIOS after the
Morgarella [4.7K]

Answer:

POST

Explanation:

  • POST stands for Power On Self test.
  • The process of booting the system involves performing the self test POST.
  • POST involves testing the computer hardware which are required for proper functioning of the computer.
  • If the POST test fails, the computer performs the necessary action required for the proper functioning of the computer.It immediately raises alarm ( beeps ) . Different number of beeps represents different devices which are having trouble.
  • So, option (D) is correct option.
  • Option (A) IDE is not the test. So, option (A) is wrong option.
  • Option (B) POTS is not the test.So, option (B) is wrong option.
  • Option (C) QoS is not the test. So, option (C) is wrong option.
7 0
3 years ago
Machine-to-machine (M2M) technology enables sensor-embedded products to share reliable real-time data ________.Select one:a. ove
just olya [345]

Answer:b)via radio signals

Explanation: Machine-to-machine technology is the technology that helps in sharing of the real time information of the device that have embedded sensor.They can work without the help of the manual factors.

The data is shared through the help of the radio signals in the devices like turbines vending machines etc for the tracking purpose and managing.

Thus the other options are incorrect because short distance is a disttance, cloud services are for the collection of services and databases contains the data. So, the correct option is option (b).

5 0
4 years ago
Other questions:
  • Peter works on a huge database of numerical figures in a worksheet ranging from cell A1 to cell I50. He has to print the workshe
    15·2 answers
  • What is the problem we can't build shelter on mars ?
    6·1 answer
  • Write a C++ program that will ask the user for the name of a data file.
    11·1 answer
  • 1) In your own words, explain what a browser is. 2) Why is it important to keep your browser up to date?
    12·1 answer
  • Hi Guys,
    13·1 answer
  • In the circuit shown in the figure above, what will happen when switches S1 and S3 are both closed? 
    8·1 answer
  • What are the first steps in creating a business document
    6·2 answers
  • Explain the four misconceptions about entrepreneurship.
    7·1 answer
  • 3.2 code practice question 2. Not in a rush.​
    15·1 answer
  • Which of these lists correctly counts from 1 to 5 In binary
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!