Computers and Technology

Online shopping cart (Java):
Create a program using classes that does the following in the zyLabs developer below. For this, you will be working with two different class files.
(1) Create two files to submit:
O ItemToPurchase. java - Class definition
O ShoppingCartPrinter. java - Contains main() method
Build the ItemToPurchase class with the following specifications:
O Private fields
O String itemName - Initialized in default constructor to "none"
O int itemPrice - Initialized in default constructor to 0
O int itemQuantity - Initialized in default constructor to 0
O Default constructor
O Public member methods (mutators & accessors)
O setName() & getName()
O setPrice() & getPrice()
O setQuantity() & getQuantity()
(2) In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call scnr. nextLine(); to allow the user to input a new string.
Ex:
Item 1
Enter the item name: Chocolate Chips
Enter the item price: 3
Enter the item quantity: 1
Item 2 Enter the item name:
Bottled Water
Enter the item price: 1
Enter the item quantity: 10
(3) Add the costs of the two items together and output the total cost.
Ex:
TOTAL COST
Chocolate Chips 1 @ $3 = $3
Bottled Water 10 @ $1 = $10
Total: $13

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:10, autumnguidry1622
Technician a says that if a valve is open when a piston rises to the very top of a cylinder, the piston may actually strike the valve head and cause serious engine damage. technician b says if the camshaft is located in the engine block, then the engine is called an overhead valve engine, ohv engine, or an in-block camshaft. who is right? a. b only b. both a and b c. a only d. neither a nor b
Answers: 3
image
Computers and Technology, 22.06.2019 19:20, SundaeSunday
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_balance should be removed since header files should not contain constants. c)the definition of cashregister should be removed since header files should not contain class definitions. d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
image
Computers and Technology, 22.06.2019 19:40, rakanmadi87
Solve the following javafx application: write a javafx application that analyzes a word. the user would type the word in a text field, and the application provides three buttons for the following: - one button, when clicked, displays the length of the word.- another button, when clicked, displays the number of vowels in the word.- another button, when clicked, displays the number of uppercase letters in the word(use the gridpane or hbox and vbox to organize the gui controls).
Answers: 1
image
Computers and Technology, 22.06.2019 21:10, itsmichaelhere1
Dameas communication challenge is due to which factor
Answers: 2
Do you know the correct answer?
Online shopping cart (Java):
Create a program using classes that does the following in the zy...

Questions in other subjects:

Konu
Mathematics, 16.01.2021 04:40
Konu
Mathematics, 16.01.2021 04:40
Konu
English, 16.01.2021 04:40