(1) Create two files to submit: ItemToPurchase.java - Class definition 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 0 int itemQuantity - Initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName() & getName() \ setPrice() & getPrice()  setQuantity() & getQuantity()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

(1) Create two files to submit:

  • ItemToPurchase.java - Class definition

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 0
    • int itemQuantity - Initialized in default constructor to 0
  • Default constructor
  • Public member methods (mutators & accessors)
    • setName() & getName() \
    • setPrice() & getPrice() 
    • setQuantity() & getQuantity() 
**Lab Activity: Online Shopping Cart (Part 1)**

**File Name: ItemToPurchase.java**

### Instructions
In this lab activity, you will begin implementing **Part 1** of an Online Shopping Cart program. This task involves creating a class named `ItemToPurchase`.

### Task Description
1. **Write the code for the ItemToPurchase class**:
   - You are required to implement several methods and attributes. Ensure to include:
     - Instance variables
     - Constructors
     - Accessor and Mutator methods

2. **Objective**:
   - By the end of this session, you should have a functional class that can be utilized in managing the items customers wish to buy.

### Code Editor
- The editor is open, and you can begin coding by typing inside the provided area.
- A comment is present indicating where you should start: `/* Type code here. */`

### Additional Details
This part of the project is crucial for understanding how objects interact within a shopping cart context. It sets the foundation for future parts where these objects will be manipulated further to simulate real-world cart operations.

By completing this lab, you will enhance your skills in object-oriented programming and gain hands-on experience in structuring a class with proper methods and attributes.
Transcribed Image Text:**Lab Activity: Online Shopping Cart (Part 1)** **File Name: ItemToPurchase.java** ### Instructions In this lab activity, you will begin implementing **Part 1** of an Online Shopping Cart program. This task involves creating a class named `ItemToPurchase`. ### Task Description 1. **Write the code for the ItemToPurchase class**: - You are required to implement several methods and attributes. Ensure to include: - Instance variables - Constructors - Accessor and Mutator methods 2. **Objective**: - By the end of this session, you should have a functional class that can be utilized in managing the items customers wish to buy. ### Code Editor - The editor is open, and you can begin coding by typing inside the provided area. - A comment is present indicating where you should start: `/* Type code here. */` ### Additional Details This part of the project is crucial for understanding how objects interact within a shopping cart context. It sets the foundation for future parts where these objects will be manipulated further to simulate real-world cart operations. By completing this lab, you will enhance your skills in object-oriented programming and gain hands-on experience in structuring a class with proper methods and attributes.
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Properties of CSS
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education