Description
Question 1 (Grading System Program) 6 pts
In this question, you will write a program to estimate the letter grade based on Concordia
undergraduate grading system .
Your program should follow the following rules:
• Prompt the user to enter name, id and score and validates the information.
• The student name should be entered as “LastName, FirstName” (separated by comma).
Please note the whole name should be saved in one string.
• The student ID must have 7 digits.
• The student’s SCORE must greater or equal to 0 and less or equal to 100.
• If the user enters invalid information, your program should repeat the current question.
• If the user enters correct information, your program should display the letter grade based
on the score. When the letter grade is displayed, the output should be
“FirstName LastName got SCORE. Based on the grading system, FirstName (ID) will probably get X.”
COMP248/Winter 2021 – Assignment 2 Page 2 of 5
Please note, score >= 80, X = A, with the output message “Congratulations!”;
score >= 70, X = B, with the output message “You are so close to A!”;
score >= 60, X = C, with the output message “You can do better by more practice!”;
score < 60, X = FNS, with the output message “Please work harder to pass the course!”;
• Your program should be able to ask user for new input of user’s information for estimation
until get the input Yes from the user.
• Display welcome & closing messages.
The following are sample screen shots to illustrate the expected behavior of your program. Your
program must display the same information with the same format.
Figure 1. Sample output of Question#1
Question 2 (Online Order Program) 8pts
In this question, you will write a program to help the customer order food online and calculate the
total price.
Your program should follow the following rules:
• Prompt the user to enter the choice based on the menu and validates the information
• The choice should be an integer number displayed on menu from 1 to 6.
COMP248/Winter 2021 – Assignment 2 Page 3 of 5
• A price to calculate the total expense of the user.
• Please find the menu and price in the following table. You must use switch statement to
create the menu options.
Menu Price without Meat Price with beef Price with pork
1. Hamburger $7.5 $25.5 $17.5
2. Pizza $7.5 $25.5 $17.5
3. Noodle $7.5 $25.5 $17.5
4. Salad $7.5 $25.5 $17.5
5. Sandwich $7.5 $25.5 $17.5
6. Exit
• Your program should be able to ask user’s new choice if the user enters Yes for more food.
• If the total price is less than $50, the customer needs to pay $5 for delivery.
• Your program should ask the amount of tips that the customer would like to pay.
• Display welcome/closing messages.
The following are sample screen shots to illustrate the expected behavior of your program. Your
program must display the same information with the same format.
Figure 2. Sample output of Question#2
COMP248/Winter 2021 – Assignment 2 Page 4 of 5
Figure 3. Sample output of Question#2
Figure 4. Sample output of Question#2
COMP248/Winter 2021 – Assignment 2 Page 5 of 5
Submitting Assignment 2
– Zip the source code (the .java file only please) of this assignment.
– Naming convention for zip file: Create one zip file, containing the source files for your
assignment using the following naming convention:
Ø The zip file should be called a#_studentID, where # is the number of the assignment
and studentID is your student ID number.
For example, for the first assignment, student 123456 would submit a zip file named
a1_123456.zip
– Submit your zip on moodle.
– Submit your assignment as “Programming Assignment” and select Submission 2 for
Assignment #2. Assignments not submitted to the correct location will not be graded.
– Be sure to keep your submission confirmation email.
Evaluation Criteria for Assignment 1 (20 points)
Source Code
Comments for all 3 questions (3 pts.)
Description of the program (authors, date, purpose) 1 pts.
Description of variables and constants 1 pt.
Description of the algorithm 1 pts.
Programming Style for all 3 questions (3 pts.)
Use of significant names for identifiers 1 pt.
Indentation and readability 1 pt.
Welcome Banner/Closing message 1 pt.
Question 1 (6 pts.)
Prompt user/read data 1 pt.
Determine the letter grade 2 pts.
Ask the user for a new input 1 pt.
Display results 2 pts.
Question 2 (8 pts.)
Prompt user/read data 2 pt.
Determine the food and total price 2 pts.
Determine the delivery fee and tips 2 pts.
Display correct results 2 pt.
TOTAL 20 pts.