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 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;...

  • 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,...

  • Problem Description to implement a Java application, called ShoppingApplication, that can be used in a retail...

    Problem Description to implement a Java application, called ShoppingApplication, that can be used in a retail store. You are asked to implement three classes: Item, Invoice, and InvoiceDriver. Each of these classes is described below. Item class The Item class represents of an item that is being sold in the retail store (e.g., book or pencil) where an item is identified by three instance variables: name (of type Sring), weight (of type double), price (of type double), and currentDiscount (of...

  • For this question,  we want to implement the basic java classes to support the concept of an...

    For this question,  we want to implement the basic java classes to support the concept of an Online Store and a shopping cart. Consider an e-store with various types of items: books, flowers, gift cards, etc... and we like to be able to support the ability to handle a shopping cart that can contain various types of items. For this question you are asked to create the following classes: abstract class: “Item” every item has a unique item_id (a positive integer,...

  • 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

  • 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...

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