CSE 101 Programming Assignment 3 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (6 votes)

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
take arrays as parameters for the starting inventory. Then will ask the customer to
request items, show a total, take a payment from the customer and display the change
total.
To facilitate the execution of this program, you will write (at minimum) the following
methods:
1. displayMenu(item, price)
a. A new method to display the options based on the contents of the arrays
b. Takes an array of strings and an array of decimal numbers as parameters
c. Displays to the output each of the name and price of each item in the
arrays preceded by a consecutive number ending with “0 – to checkout”
d. Returns None
2. store(item, quantity, price)
a. A method to run the store program
b. It will take three parameters
i. String array for names of the items in stock
1. For each item in this array it will change the name to
capitalize the first letter and lowercase other letters
ii. Integer array for number of each item
iii. Decimal array for price of each item
c. It will run according to the description above until the user types “0” for
the prompt.
d. NOTE: This method will use much of the main method from your previous
assignment
e. Returns None
CSE 101 Programming Assignment 3 Page 2 of 4
CSE 101|Fall 2019 2
3. capitalize(name)
a. For each value in the name array, format name with the first letter
uppercase; all other letters lowercase
b. Takes an array of Strings as a parameter
c. Returns none
d. Note: You can call your previous capitalize method from this method
using method overloading
4. validRequest(quantity, request)
a. No change
5. cashReturned(amount)
a. No change
6. Any other methods you feel helpful can be implemented, however, these will be
the only methods tested.
Design:
When store is called, your program should display the list of items and prices to the
customer and ask what he/she would like to purchase. When the customer decides to
checkout, the total will be shown and the amount given will be entered. If the amount is
enough, the change will be given and the remaining amounts will be displayed. The
customer should be able to add more items of a given type (i.e. the customer may decide
to buy more of something).
The example on the next page was executed using the following code:
Note: The code above was a main method used to execute the store program. You are
not required to have a main method. You are encouraged to use a main method to test
your store program. If you include a main method, it will not be used for grading
purposes.
CSE 101 Programming Assignment 3 Page 3 of 4
CSE 101|Fall 2019 3
CSE 101 Programming Assignment 3 Page 4 of 4
CSE 101|Fall 2019 4
If the customer enters an invalid choice or invalid amount requested, the program
should display an error message. Also, the program should keep asking for an amount
given until a total that is greater than or equal to the total is entered. Examples shown
below:
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:
Google Classroom Submission: If anything is ambiguous, it is your responsibility to ask
questions. It is also your responsibility to complete this assignment in a timely manner. Emails with questions regarding this assignment will likely not be answered if received after
17:00 on the due date of the assignment. You can submit multiple times using Google
Classroom, however, we will only grade the last version that you submitted.
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.
Quiz in Lab: There will be a quiz based on this assignment given on 13-December. The result
of this quiz will be used to determine your grade on this assignment. Note: if you do not
attend the lab and take the quiz, your score on this assignment will be 0.