Programming Assignment 2 Solution

$30.00 $24.00

Deliverables: The following Java file should be submitted to Google Classroom by the due date and time specified above. Submissions received after the deadline will be subject to the late policy described in the syllabus. Store_{StudentNumber}.java Specifications: Overview: You will continue the program this week to maintain the inventory for a store. Do not forget…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Deliverables:

The following Java file should be submitted to Google Classroom by the due date and time specified above. Submissions received after the deadline will be subject to the late policy described in the syllabus.

  1. Store_{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 four (4) products where each will have:

  1. Name – String

    1. Should be assigned as the value the owner enters with the first letter capitalized and all other letters lower case

  1. Quantity – Integer

    1. If the value passed is negative, the assigned quantity should be the positive value

  1. Price – Floating point number

    1. If the value passed is negative, the assigned price should be the positive

value

Once the owner has entered the four products’ information, the program will then prompt the customer for which of the four products he/she would like to purchase. Once the customer has completed the order, the program will display their total.

Finally, the program will ask for the amount the customer gives to pay for his/her items.

To facilitate the execution of this program, you will write (at minimum) the following methods:

  1. main()

    1. A method to run the Store program

    1. It will ask the store owner for the four product information.

    1. It will then run according to the description above until the customer types “0” for the prompt.

    1. Returns None

  1. capitalize(name)

    1. Format name with the first letter uppercase; all other letters lowercase

    1. Takes one String type parameter

    1. Returns a String

Page 2 of 4

  1. validRequest(quantity, request)

    1. A method to verify the requested amount is valid

    1. Takes two integer type parameters for the current quantity and the number requested by the customer

    1. Returns a boolean

      1. True if request is positive and less than or equal to quantity

      1. False for all other values

  1. cashReturned(amount)

    1. A method to determine the type of bills and coins to be given

    1. Takes one parameter for the amount to be given

    1. Returns a String containing the number of each type of bill in the format of “# – Type” (i.e. “2 – 20”, “3 – 1”), each on a separate line.

      1. The values tested will be standard TL types (200, 100, 50, 20, 10, 5, 1, 0.50, 0.25, 0.10, 0.05, 0.01)

  1. Any other methods you feel helpful can be implemented, however, these will be the only methods tested.

Design:

When capitalize is called with the given parameters, the following values should be returned:

When validRequest is called with the given parameters, the following values should be returned:

When the method cashReturned is called with the following values, the returned String should be one of these shown.

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 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.

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:

CSE 101|Fall 2018

3

CSE 101 Programming Assignment 2 Page 4 of 4

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. E-mails 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 22-November. 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.

CSE 101|Fall 2018

4

Programming Assignment 2 Solution
$30.00 $24.00