COMP 248 Assignment 1 solution

$24.99

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

Description

5/5 - (3 votes)
Question 1
Write a program that asks the user for several pieces of information, and displays them on the
screen afterward as a summary.
 first name
 last name
 major
 year
 student id number
 login name
 GPA (0.0 to 4.3)
Assume the first name, last name, major and login have no spaces in them, in other words are
one word long or have a hyphen in them.
Here are a few sample outputs to illustrate the expected behavior of your program. You should
follow the same formatting as shown below.
Note: user input is highlighted in grey.
Question 2
Write a program that asks a user his/her name and age and displays the following depending on
their age:
 Age is less than 16, say “You can’t drive.”
 Age is less than 18, say “You can’t vote.”
 Age is less than 25, say “You can’t rent a car.”
 Age is 25 or over, say “You can do anything that’s legal.”
Here is an example of the output to illustrate the expected behavior of your program. You may
change the formatting of the output but the program should follow the described behavior.
Note: user input is highlighted in grey.
———————————————————
Student Information System
———————————————————
First name: Jane
Last name: Doe
Major: COMPSCI
Year: 3
ID: 250876234
Login: j_doe
GPA (0.0 – 4.3): 4.2
Your student information:
Login: j_doe
ID: 250876234
Name: Doe, Jane
Field and year: COMPSCI, 3
GPA: 4.2
That’s all folks!
/****************************************************************/
/******** All the things you cannot do… **************/
/****************************************************************/
Hi there! What’s your name? Greta
Nice to meet you Greta, how old are you? 24
Ok, Greta did you know, you can’t rent a car.
Talk to you next time!
Question 3
Isabel Briggs Myers developed a theory that there are 16 different personality types. Each type
has four letters associated with it, I or E (Introvert/Extrovert), S or N (Sensor or iNtuitive), T or F
(Thinker or Feeler) and J or P (Judger or Perceiver). (https://www.truity.com/view/types)
Develop a simple program that will determine a user’s personality based on their response to 4
questions that are to be answered by them on a scale of 1 to 10. The first question is to ask the
user if they want to do the quiz, whether the answer is yes/no, the user will still do the quiz but
a different message will be printed in each case. Next, get the user to answer the four questions
below on a scale from 1-10. Based on the answer to each question, a letter of the personality
type should be set as indicated below.
Q1: How do you get your energy?
1- Spending time alone
10- Spending time with others
Score <= 5 indicates and introvert (I) and >5 indicates extrovert (E)
/****************************************************************/
/******** All the things you cannot do… **************/
/****************************************************************/
Hi there! What’s your name? Greg
Nice to meet you Greg, how old are you? 15
Ok, Greg did you know, you can’t drive.
Talk to you next time!
/****************************************************************/
/******** All the things you cannot do… **************/
/****************************************************************/
Hi there! What’s your name? Luke
Nice to meet you Luke, how old are you? 17
Ok, Luke did you know, you can’t vote.
Talk to you next time!
/****************************************************************/
/******** All the things you cannot do… **************/
/****************************************************************/
Hi there! What’s your name? Maggie
Nice to meet you Maggie, how old are you? 45
Ok, Maggie did you know, you can do anything that’s legal!
Talk to you next time!
Q2: How do you see the world & gather information?
1- In concrete terms
10- In abstract terms
Score <= 5 indicates Sensors (S) and >5 indicates iNtuitives (N)
Q3: How do you make your decisions?
1- Using my head
10- Using my heart
Score <= 5 indicates Thinkers (T) and >5 indicates Feelers (F)
Q4: How much do you like to plan?
1- Make plans far in advance 1
10- Go with the flow
Score <= 5 indicates Judgers (J) and >5 indicates Perceivers (P)
Here are a few sample outputs to illustrate the expected behavior of your program.
Note: user input is highlighted in grey. Note you can assume a smart user, and do not have to
do error handling in case they enter data incorrectly.
———————————————————
The Simple Personality Test!
———————————————————
Are you ready for a personality test? (Yes/No): Yes
All right here we go!
Answer the following questions on a scale from 1-10.
Q1: How do you get your energy?
1 — By spending time alone
10 — By spending time with others
4
Q2: How do you see the world & gather information?
1 — In concrete terms
10 — In abstract terms
7
Q3: How do you make your decisions?
1 — Using my head
10 — Using my heart
9
Q4: How much do you like to plan?
1 — Make plans far in advance
10 — Go with the flow
2
Your personality type is: *INFJ*
To find out more about that type of personality check out:
https://www.truity.com/view/types
Hope you had fun! See you next time!
———————————————————
The Simple Personality Test!
———————————————————
Are you ready for a personality test? (Yes/No): No
Alright, well we’re going to do it anyways!
Answer the following questions on a scale from 1-10.
Q1: How do you get your energy?
1 — By spending time alone
10 — By spending time with others
7
Q2: How do you see the world & gather information?
1 — In concrete terms
10 — In abstract terms
3
Q3: How do you make your decisions?
1 — Using my head
10 — Using my heart
5
Q4: How much do you like to plan?
1 — Make plans far in advance
10 — Go with the flow
10
Your personality type is: *ESTP*
To find out more about that type of personality check out:
https://www.truity.com/view/types
Hope you had fun! See you next time!
Submitting Assignment 1
Please check your course Moodle webpage on how to submit the assignment.
Evaluation Criteria for Assignment 1 (20 points)
Source Code
Comments for all 3 questions (5 pts.)
Description of the program (authors, date, purpose) 2 pts.
Description of variables and constants 1 pt.
Description of the algorithm 2 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 (3 pts.)
Prompting user/reading data 1.5 pts.
Display results 1.5 pts.
Question 2 (3 pts.)
Read in name and age 1 pt.
Determine what person can’t do 1 pt.
Display correct results 1 pt.
Question 3 (6 pts.)
Prompting user/reading data 1 pt.
Ask 4 questions and set correct personality characteristic 2 pts.
Determine personality type 1 pts.
Display results 1 pt.
TOTAL 20 pts.