CMSC 140 Programming Project 1 solution

$30.00

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

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

 

Hello, welcome to Montgomery College! My name is Nao. May I have your name?

john Smith

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

PROGRAMMER: Your Name

CMSC140 Common Project 1

Due Date:

 

 

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
  • Due date

 

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.
  • 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.
  • A constant variable for Due Date. Initialize the variable with the due date of this assignment.
  • 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;
  1. 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.

 

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

-If your program does not compile, project will get a grade of “0”. Contact your instructor prior to the project submission due date if you have compilation issues.

-If your project has compilation errors and you are not able to resolve them, try to see your instructor during his/her office hour or go to tutoring session for help prior to project’s due date.

– Check your instructor’s office hours as well as the location and the schedule of the tutoring sessions with your instructor.

Details for Deliverables:

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

 

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

 

Include the following in your code:

Program Header: All programming projects’ source code need to have one block comment at the top of the program containing the course name and CRN, the project number, your name, project description, and the due date. Provide any additional comments as necessary to clarify the program.
Following is a template of the required program header:

 

/*

* Class: CMSC140 CRN

* Instructor:

* Project<number>

* Description: (Give a brief description for Project)

* Due Date:

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

  1. 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: 100 Points Earned:
  Name  
  PLANNING
  Flow chart submitted 5
Pseudo code provided 5
Test plan/data provided 5
  TESTING
  Passes sample data tests 15
Passes student  data tests 5
Passes private instructor data tests 65
Possible Sub-total 100
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 -10
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) -20
Use control structure other than sequence without explanation (-10)
Not use basic arithmetic operators (-10)
    Not meet input requirement(s) -10
Not take all required input
    Not meet output requirement(s) -20
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) -10
Not use variables, constants and literals (-4)
Not use different data types/objects (-3)
Not declare and initialize all required data items (-3)
 
Possible decrements: -100
Possible total grade: 100 Points Earned: