CSE101 Assignment 02

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

CSE 101 Programming Assignment 2 Page 1 of 3

Due:
Sunday, 13-November-2022 by 23:59

Deliverables:
The following Java files should be submitted to MS Teams by the due date and time
specified above. Submissions received after the deadline will be subject to the late
policy described in the syllabus.
o TwoItemStore_{StudentNumber}.java
Specifications:

Overview: You will continue the program this week to maintain the inventory for a store. Do
not forget your headers with @author and @since information. This program will be
expanded in future weeks, so be sure you understand the concepts covered in this program.

Requirements: Write a program that will simulate the user interface for a store. It will
first prompt the store owner for two (2) products where each will have:
1. Name – String
a. Should be assigned as the value the owner enters with the first letter
capitalized and all other letters lower case
2. Quantity – Integer
a. If the value passed is negative, the program should display an error
message and end
3. Price – Floating point number
a. If the value passed is negative, the program should display an error
message and end
Once the owner has entered the two products’ information, the program will then
prompt the customer for which of the two products he/she would like to purchase. Once
the customer has completed the order, the program will display their total.

If the customer requests 0 or negative amount of something, the system will display an
error message and return to the main menu. If the customer enters an invalid product
number, the system will display an error message and return to the main menu.

Design:
When run, your program should ask the owner for the product information, then the
customer for what he/she would like to purchase. When the customer decides to
checkout, the total will be displayed.

CSE 101|Fall 2022 1


CSE 101 Programming Assignment 2 Page 2 of 3

If the store enters an invalid value for quantity or price, the system should display a
message and exit:

If the customer enters an invalid choice or invalid amount requested, the program
should display an error message and return to the main menu. Examples shown below:

CSE 101|Fall 2022 2


CSE 101 Programming Assignment 2 Page 3 of 3

Code: Create variables for the various values entered by the user and assign it using the
Scanner object. As a user enters valid values update the values of the variables
accordingly.

Test: You are responsible for testing your program. It is important to not rely solely on
the examples presented in this Project description.

Grading:
MS Teams Submission: You can submit multiple times, however, we will only grade the last
version that you submitted.

NOTE: If you use System.exit() in your code, you will automatically receive 0 points for this
assignment.

Filename: You must name your java file according to the description above. If your file is not
named in this way, your submission for this assignment will not be accepted.

CSE 101|Fall 2022 3

You might also like