Question: public class ItemToPurchase { / / Private fields - itemName, itemPrice, and itemQuanity / * Default Constructor itemName - Initialized to none itemPrice - Initialized
public class ItemToPurchase
Private fields itemName, itemPrice, and itemQuanity
Default Constructor
itemName Initialized to "none"
itemPrice Initialized to theta
itemQuantity Initialized ito theta
public member methods mutators & accessors
setName & getName
setPrice & getPrice
setQuantity & getQuantity
print item to purchase
public void printItemPurchaseDefault Constructor
itemName Initialized to "none"
itemPrice Initialized to
itemQuantity Initialized ito
public member methods mutators & accessors
setName & getName
setPrice & getPrice
setQuantity & getQuantity
print item to purchase
public void printItemPurchase
System.out.printlnitemQuantity itemName $ itemPrice
$itemPrice itemQuantity;
IT Lab Activity Module Item
Enter the item name: Chocolate Chips
Enter the item price:
Enter the item quantity:
Item
Enter the item name: Bottled Water
Enter the item price:
Enter the item quantity:
Add the costs of the two items together and output the total cost. pts
Ex:
TOTAL COST
Chocolate Chips @ $$
Bottled Water @ $$
Total: $
Online shopping cart Java
Create a program using classes that does the following in the zyLabs developer below. For this lab, you will be working with two different class files. To switch files, look for where it says "Current File" at the top of the developer window. Click the current file name, then select the file you need.
Create two files to submit:
ItemToPurchase.java Class definition
ShoppingCartPrinter.java Contains main method
Build the ItemToPurchase class with the following specifications:
Private fields
String itemName Initialized in default constructor to "none"
int itemPrice Initialized in default constructor to
int itemQuantity Initialized in default constructor to
Default constructor
Public member methods mutators & accessors
setName & getName pts
setPrice & getPrice pts
setQuantity & getQuantity pts
In main prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call scnrnextLine; to allow the user to input a new string. pts
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
