Question

Please implement the following only using Javascript. design a cash register class that can be used...

Please implement the following only using Javascript.

design a cash register class that can be used with inventory item class. The cash register class needs to:

1. ask user for item and quantity being purchased.

2. get the items cost from inventory item object

3. add 30% profit to the cost to get the items unit price

4. multiply the unit price times the quantity being purchased to get purchase subtotal

5. compute a 6% sales tax on the subtotal to get the purchase total

6. display the purchase subtotal, tax, and total to the screen

7. subtract the quantity being purchased from variable of inventory item class object

Thank you for all of your help. remember Only Javascript can be used.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution import java.awt.: import java util.*; import java lang.*: import java.io. import iava.util. String import java apple//constructor #1 public Inventoryltemo //store an empty string in the description attribute. createDescription(GlobalMembers.//Mutator functions public final void setDescription(tangible.RefObject<String> d) description d.argValue; public final voidpublic class GlobalMembers //Specification file for the Inventoryltem class. //constant for descriptions default size public/ORIGINAL LINE: double getItemCostO const public final double getItemCostO return itemCost; /ORIGINAL LINE: double getTaxRate/ORIGINAL LINE: Sale2(double price, double profit- 0.3) public Sale2(double price, double profit) itemPrice price; profitRateprivate static int MainO int numSelected double qtySelected; byte again; double price, double cost; final int NUM ITEMS 5 Invelse System-out.printf %7d.inventory[i].getUnitsO-qwSelected): System.out.printf%d, n); System-out.printf(%d. ); Syprice - inventorv[numSelectedl.getCost: System-out.printf(%d. ) System-out-printf(%d: in); System-out-printf(%dpackage tangible; public final class Consolelnput private static boolean goodLastRead- false; public static boolean lastReadWpublic static String scanfRead return scanfRead(null, -1) public static String scanfRead(String unwantedSequence) return scanelse /lensure each character matches the expected character in the sequence: nextChar (char)System in.read0; if (nextCharunwa

Add a comment
Know the answer?
Add Answer to:
Please implement the following only using Javascript. design a cash register class that can be used...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write the following program in Java using Eclipse. A cash register is used in retail stores...

    Write the following program in Java using Eclipse. A cash register is used in retail stores to help clerks enter a number of items and calculate their subtotal and total. It usually prints a receipt with all the items in some format. Design a Receipt class and Item class. In general, one receipt can contain multiple items. Here is what you should have in the Receipt class: numberOfItems: this variable will keep track of the number of items added to...

  • in java PART ONE ======================================= Below is the "RetailItem" class definition that we used in Chapter 6. Write a "CashRegister" class that leverages this "Ret...

    in java PART ONE ======================================= Below is the "RetailItem" class definition that we used in Chapter 6. Write a "CashRegister" class that leverages this "RetailItem" class which simulates the sale of a retail item. It should have a constructor that accepts a "RetailItem" object as an argument. The constructor should also accept an integer that represents the quantity of items being purchased. Your class should have these methods: getSubtotal: returns the subtotal of the sale, which is quantity times price....

  • In C++ Write a header cashRegister.h and source cashRegister.cpp files for the a CashRegister class. The...

    In C++ Write a header cashRegister.h and source cashRegister.cpp files for the a CashRegister class. The class a CashRegister class has the following data members: 1) an array of 100 Item objects. 2) Cash Register Name and 3) Count of Item objects purchased. 4) Item Cash Total 5) State Tax Rate. The Item is represented as a class in an item.h file. The Item class has the following data members: 1) Name of the item 2) Cost of the item....

  • Write code in Java programming language. The ShoppingCart class will be composed with an array of...

    Write code in Java programming language. The ShoppingCart class will be composed with an array of Item objects. You do not need to implement the Item class for this question, only use it. Item has a getPrice() method that returns a float and a one-argument constructor that takes a float that specifies the price. The ShoppingCart class should have: Constructors: A no-argument and a single argument that takes an array of Items. Fields: • Items: an array of Item objects...

  • Complete the CashRegister class by implementing the methods and adding the correct attributes (characteristics) as discussed...

    Complete the CashRegister class by implementing the methods and adding the correct attributes (characteristics) as discussed in class. Once complete, test the class using the CashRegisterTester class. Make sure you have 3 total items in the cash register. I have two classes, the first is CashRegisterTester below: public class CashRegisterTester { public static void main(String[] args) { //Initialize all variables //Construct a CashRegister object CashRegister register1 = new CashRegister(); //Invole a non-static method of the object //since it is non-static,...

  • Use exceptions to correct errors and please don't use stacks 2. Write a class called ShoppingBag...

    Use exceptions to correct errors and please don't use stacks 2. Write a class called ShoppingBag to keep track of items purchased. The ShoppingBag contains a summary of an order. It will implement the Retail interface (given below) and will need some additional methods to place items in the bag and to output the bags current status. ShoppingBag contains the total cost of items purchased (before tax), the total after tax, the number of items in the bag, and the...

  • Write a CashRegiste class that can be used with the Retntailtem class that you wrote in...

    Write a CashRegiste class that can be used with the Retntailtem class that you wrote in the module4. The cashRegister class should simulate the sale of a retail item. It should have a constructor that accepts a Retilltem objectject The constructor should also accept an integer that represents the quantity of item being purchased. In addition, the class should have the following properties and methods: as an argument. private final double TAX RATE private double retail; private int quantity; 0.06;...

  • {Please, I need the solution by ( C cood ) not C++ } Question 1 CSEB113...

    {Please, I need the solution by ( C cood ) not C++ } Question 1 CSEB113 Write a program to create customer's bill for an electrical appliance company. Assume the company sells only three different products: TV, VCR and CD player. The unit prices are RM3000, RM500 and RM300 respectively. The program must read the quantity of each piece of the items purchased from the user. It then calculates the cost of each item, the subtotal and the total cost...

  • Object Oriented Programming using class c++ Program where the users (customers) can add Product name, Product...

    Object Oriented Programming using class c++ Program where the users (customers) can add Product name, Product Price, Product Quantity. Program needs a menu: 1. Add item 2. Get total 3. Display all items

  • in python Write a class named RetaiI_Item that holds data about an item in a retail...

    in python Write a class named RetaiI_Item that holds data about an item in a retail store. The class should store the following data in attributes: • Item Number • Item Description • Units in Inventory • Price Create another class named Cash_Register that can be used with the Retail_Item class. The Cash_Register class should be able to internally keep a list of Retail_Item objects. The class should include the following methods: • A method named purchase_item that accepts a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT