CMSC140 Project 1 Solved

25.00 $

Category:

Description

5/5 - (1 vote)

Chapters Covered:

• Chapters 1, 2, and 3

Concepts tested in this project

• To work with cout and cin objects
• To work with variables, constants and literals
• To work with string object
• Use of different data types
• To follow programming style
• Use of basic arithmetic operators
• Use of output manipulators (setw, fixed, setprecision)

Project Description

The Department plans to purchase a humanoid robot. The Chairman would like you to write a program to show a greeting script the robot can use later. Your first task is to use the following script to prototype the robot for presentation:

**************** Robot Prototype Scripting ********************

Nice to have you with us today, john Smith!
Let me impress you with a small game.
Give me the age of an important person or a pet to you. Please give me only a number:
2

You have entered 2.
If this is for a person, the age can be expressed as:
2 years or 24 months or about 720 days or about 17280 hours or about 1036800 minutes or about 62208000 seconds.
If this is for a dog, it is 14 years old in human age.
If this is for a gold fish, it is 10 years old in human age.

Let’s play another game, john Smith. Give me a whole number.
4
Very well. Give me another whole number.
5
Using the operator ‘+’ in C++, the result of 4 + 5 is 9. Using the operator ‘/’, the result of 4 / 5 is 0 however, the result of 4.0 / 5.0 is about 0.8.

Thank you for testing my program!!

Write a program that uses the script above as a guide without roles, i.e. robot computer and visitor human, to prototype robot greeting in C++. See the Sample Screen Output below.

Project Specifications

Input
• Visitor’s name
• An age
• Two numbers

Output: The program should display the following data:
• Complete script described above
• Your name as the programmer
• Assignment/Project number

Processing Requirements

1. The program should declare and initialize (i.e. create and assign values for) variables/constants to hold (at least) the following data:
• Robot Name. This variable will hold the Robot Name. Initialize the variable with “Nao” or a name of your choice.
• Visitor Name, this variable will hold the user’s name.
• Age. This variable will hold a person’s or a pet’s age.
• A constant variable for Programmer’s Name. Initialize the variable with your full name.
• A constant variable for Assignment Number. Initialize the variable with the value 1.
• Constant variables for Days of Month, Human Year, Gold Fish Year. Initialize the variables, for example const int ONE_DOG_YEAR = 7; const int
DAYS_PER_MONTH = 30;

2. Use the above variables when creating the output of the program, for example:

cout << “My name is “ << robotName;

Where robotName is a variable defined in your program.

3. Use the following for the computations in the program :

• 1 month = 30 days
• Dog’s age = 7 times human’s age,
• Gold fish age = 5 times human’s age

Sample Screen Output

NOTE: Be sure to check also
1. CMSC140 Common Project Submission Requirements
2. CMSC140 Grading Rubric_CheckList-Project 1

Test Plan
Test your program with at least two more test cases. Use the given data as an example. Record your data for input and output in the following table. Make sure your tests cover all the possible scenarios.
Test
Case # Input Actual Input Expected Output
Actual Output

Did the test pass?

1 2
4
5
24
720
17280
1036800
62208000
14
10
9
0
.8

2
3
4

CMSC140 Common Project Submission Requirements

Important NOTE:
Details for Deliverables:
1. Word document(docx) or .pdf including:
a. Title page including student name, project title and number
b. Completed Test Plan table ( given in the project’s description document)
c. Screenshot of the program run (using test data from the Test Plan)
d. Pseudocode/Flowchart ( if applicable to the project )
e. “Lessons Learned” section describing any issues you experienced during work on the project and how you solved them or your overall experience.

2. C++ file (source code): FirstInitialLastName_Pr<number>.cpp

Include the following in your code:
Following is a template of the required program header:

/*
* Class: CMSC140 CRN
* Project<number>
* Description: (Give a brief description for Project)
* I pledge that I have completed the programming assignment independently.
I have not copied the code from a student or any source.
I have not given my code to any student.
Print your Name here: __________

* Pseudocode or Algorithm for the program:
(be sure to indent items with control structure) (need to match flow chart submitted in documentation) 1. 2. 3. 4.
5.
(more as needed)
*/

Comments: Add comment to variables, formulas, or any part of the program with the purpose of making the source code easier to understand.
Indentation: It must be consistent throughout the program and must reflect the control structure.
Proper naming conventions: Variable and method names need to be descriptive to show the role of the variable or method. Avoid single letter names. Constant names should be all upper case, variable names should use “camel case” (i.e. start with lower case, with subsequent words starting with upper case: hoursWorked for example) or underscores to separate words (i.e. items_ordered).
3. Checklist (grading sheet posted on Blackboard): Specific project checklist and grading rubric worksheet should be completed with your name in the highlighted cell and your initials in the checkboxes.
What to submit on Blackboard?
You need to submit the following two files to Blackboard:
• Word document(docx) or .pdf: FirstInitialLastName_Pr<number>.docx or .pdf • C++ file (source code): FirstInitialLastName_Pr<number>.cpp

✔ CMSC140 Grading Rubric – Project 1 Possible total grade: 1
0
0 Points Earned:

Name

PLANNING
Flow chart submitted 5
Pseudo code provided 5
Test plan/data provided 5
TESTING
Passes sample data tests 1
5
Passes student data tests 5
5
Possible
Sub-total 1
0
0

REQUIREMENTS (Subtracts from PLANNING and TESTING totals)
Documentation:
Title page is missing or incomplete -2
Screenprints Screenshots of program run not provided -3
Learning Experience not included -4
In 3+ paragraphs, highlight your lessons learned and learning
experience from working on this project. What have you learned?
What did you struggle with? What would you do differently on your next project?
Program header/documentation within source code is missing, incomplete or incorrect –
1
0
Author’s Name is missing (-2)
Function not commented properly (-
2)
Pseudo code not match program file submitted or incomplete (-6)
Deliverables:
Deliverables packaged incorrect or incomplete -3
Programming Style:
Incorrect use of indentation, naming convention, lack of white space separating variables, operators, and functions, indentation, etc. (see coding/style standards) -5
User interface
Not clear to user how data is to be entered -4
Output is not easy to understand -4
Input validataion not performed or incomplete (not required for first assignment) -5
Design/Processing:
Not use required control structure(s), operator(s) or statement(s) –
2
0
Use control structure other than sequence without explanation (-10)
Not use basic arithmetic operators (10)
Not meet input requirement(s) –
1
0
Not take all required input
Not meet output requirement(s) –
2
0
Not display or produce all required output (-10)
Not use output manipulator: setprecision, fixed, etc. (-10)
Not use required data type(s) or data structure(s) –
1
0
Not use variables, constants and literals (-4)
Not use different data types/objects (-3)
Not declare and initialize all required data items (-3)

Possible decremen
ts: –
1
0
0

Possible total grade: 1
0
0 Points Earned:

  • CMSC140_Assignment1-rpersc.zip