# CSE 101 Programming Assignment 2 user interface for a course solution

\$30.00

Category:

## Description

Overview: You will continue the program this week to maintain the grades for a student in a
course. 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 course. It will
first prompt the instructor for four (4) categories where each will have:
1. Name – String
a. Should be assigned as the value the instructor enters with the first letter
capitalized and all other letters lower case
2. Quantity – Integer
a. How many of these were given in the course?
b. If the value passed is negative, the program will ask again for a valid value
3. Weight – Integer
a. What percentage of the grade does this represent?
b. If the value passed is negative or makes the total weight of all categories
greater than 100, the program will continue to ask for a valid value
Once the instructor has entered the four categories’ information, the program will check
if the total of all weights is 100. If not, it will display an error message and exit.
Otherwise, the program will then prompt the instructor for points for the individual
items in each of the four categories. Note: for this assignment, assume all these decimal
values are valid. Also, for simplicity, each item will be considered as out of 100 points.
Once the instructor has completed the data entry, the program will display the student’s
To facilitate the execution of this program, you will write (at minimum) the following
methods:
1. main()
a. A method to run the CourseGrade program
b. It will ask the instructor for the four category information.
c. It will then run according to the description above until the instructor has
d. Returns None
CSE 101 Programming Assignment 2 Page 2 of 5
CSE 101|Fall 2020 2
2. capitalize(name)
a. Format name with the first letter uppercase; all other letters lowercase
b. Takes one String type parameter
c. Returns a String
3. validQuantity(quantity)
a. A method to verify the quantity is valid
b. Takes an integer type parameter for the current quantity
c. Returns a boolean
i. True if quantity is positive
ii. False for all other values
4. validWeight(weight, totalWeight)
a. A method to verify the weight is valid
b. Takes two integer type parameters for the weight and total weight so far
c. Returns a boolean
i. True if weight is positive and total weight + weight is not greater
than 100
ii. False for all other values
a. A method to determine the grade letter based on the grade calculated
b. Takes one decimal parameter for the grade earned
c. Returns a String for the grade letter (refer to assignment 1 for details)
a. A method to determine the gpaPoints based on the grade calculated
b. Takes one decimal parameter for the grade earned
c. Returns a decimal for the GPA points (refer to assignment 1 for details)
a. A method to determine if the student passed based on the grade
b. Takes one decimal parameter for the grade earned
c. Returns a String containing the status of “passed”, “conditionally passed”,
or “failed” (refer to assignment 1 for details)
8. 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 validQuantity is called with the given parameters, the following values should be returned:
CSE 101 Programming Assignment 2 Page 3 of 5
CSE 101|Fall 2020 3
When validWeight is called with the given parameters, the following values should be returned:
When gradeLetter is called with the given parameters, the following values should be returned:
When gpaPoints is called with the given parameters, the following values should be returned:
When status is called with the given parameters, the following values should be returned:
The program should keep asking for a value until a valid value is entered. If the total
weight is not exactly 100, the program should terminate with an error message. Examples
shown below:
CSE 101 Programming Assignment 2 Page 4 of 5
CSE 101|Fall 2020 4
When run, your main program should ask the instructor for the category information,
then student grade information. When the instructor has completed all data entry, the
grade percentages for each category will be shown and final grade information will be
displayed.
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.