please don't copy other codes In this lab, you will write two C++ programs using decision statements. Programming Proble

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

please don't copy other codes In this lab, you will write two C++ programs using decision statements. Programming Proble

Post by answerhappygod »

please don't copy other codes
In this lab, you will write two C++ programs using decisionstatements.
Programming Problem One
Write a C++ program named "student.cpp". This programprompts the user to enter the number of credit hours earned sofarand displays his/her corresponding category:
If the user input is not valid, i.e., credit hours entered <0, an error message should be displayed.
You are required to use the multi-way decision statement, i.e.,the if-else if-else, statement for this problem.
1 #include <iostream>2 using namespace std;
3
4 int main() {
5
67 return 0;8 }
Here are a few example runs of the program:
Sample run 1
Please enter your total credit hours earned: 30 You are aSophomore.
Sample run 2
Please enter your total credit hours earned: 82 You are aSenior.
Sample run 3
Please enter your total credit hours earned: 12 You are aFreshman.
Sample run 4
Please enter your total credit hours earned: -10 Invalidinput.
What to Submit for this part of the lab:
Create a script file with the steps shown below. In the scriptfile, run the program 4 times with the 4 sets of input data asshown in the 4 samples runs. script log3A pr -n -t -e4 student.cppc++ student.cpp -o runA runA runA runA runA exit
These steps creates the script file named log3A.
(Note: the name of the program needs to match therequired file name exactly for submission to besuccessful.)
Programming Problem Two
Sample run 1
Sample run 2
Sample run 3
Sample run 4
What to Submit for this lab:
These steps creates the script file named log3.
Rubric
Documentation Comments have been added to each group oflogically related statements, including each:
• Decision statement
• Loop statement
• Group of logically related statement
• User defined function
Style Variable:
• Meaningful names are used unless specified by the programdescription
• Variable naming convention is followed
• No global variable is used
Constants:
• Defined when appropriate
• Defined in the global declaration section
• Constant naming convention is followed
User defined functions:
• Defined when appropriate
• No function should have more than 25 lines of code (excludewhite lines and lines only containing curly brackets)
• Function naming convention is followed Proper Indentation isused to make the program easier to read.
• All the decision statements are indented properly.
• All the loop statements are indented properly
Body of the functions are indented Blank lines are used in frontof each block of logically related statements
Blank lines are used in front of each block of logically relatedstatements
Correctness Program solves the assigned problem using methodsdescribed in program description.
Program compiles without errors.
Program executes without crashing.
Program produces the correct output when tested using differentuser input.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply