Question

(C++) 1. Please enter your name: Tom Tom, how old are you? 22 Please enter your...

(C++) 1. Please enter your name: Tom
Tom, how old are you? 22
Please enter your scores in 4 exams: 33 55 99 60

Dear Tom,
At age 22 with scores 33, 55, 99, and
60 your average is 61.75
Your advisor

Homework Answers

Answer #1
#include <iostream>
using namespace std;

int main()
{
    string name;  //to store name
    int age;  //to store age
    int scores[4];  // to store scores of 4 exams
    
    //user input ffor name
    cout<<"Please enter your name: ";
    cin >> name;
    
    //user input for age
    cout << name << ", how old are you? ";
    cin >> age;
    
    //user input for scores
    cout << "Please enter your scores in 4 exams : ";
    for(int i = 0; i < 4; i++)
        cin >> scores[i];
    
    double total = 0;  //to store total scores
    double average;  //to store average 
    
    //calculating total
    for(int i = 0; i < 4; i++)
        total += scores[i];
   
    //calculating average
    average = total / 4;
    
    //prints appropriate output
    cout << endl << "Dear " << name << endl;
    cout << "At age " << age << " with scores ";
    for(int i = 0; i<4; i++)
    {
        if(i != 3)
            cout << scores[i] << ", ";
        else
            cout << "and " <<scores[i] << " is " << average << endl;
    }
    cout << "Your advisor";
    
    return 0;
}

Please refer to the screenshot of the code to understand the indentation of the code.

Sample Output :

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Python Jupyter Notebook Write a program that prompts the user to enter his/her first name, last...
Python Jupyter Notebook Write a program that prompts the user to enter his/her first name, last name, and year of birth in a single string (in the format: fn;ln;yyyy), then calculates the age tell it to him/her after greeting him/her using the first name. Make sure to capitalize the user's first name, regardless of how he/she typed it in. Hint: review Exercise 1! Example: Enter your first name, last name, and birth year (in format fn;ln;yyyy): alex;smith;1994 Hi Alex, you...
1. How old are you now? I am 22 years old now. I plan on retiring...
1. How old are you now? I am 22 years old now. I plan on retiring at the age of 65. Based on the assumption that I will live until the age of 90, I will need $75,000 per year. Calculate the present value of the money you will need for retirement. 1. Choose two rates of return you would like to investigate. Chose a lower, conservative number, such as the current 3 year CD rate and chose a higher,...
Statistics/ Probability question- Please show me how to enter in to Excel to find values-thank you!...
Statistics/ Probability question- Please show me how to enter in to Excel to find values-thank you! 1. A) Assume that z-scores are normally distributed with a mean of 0 and a standard deviation of 1. If P(z>c)=0.0868P(z>c)=0.0868, find c. B) Assume that z-scores are normally distributed with a mean of 0 and a standard deviation of 1. If P(z>d)=0.9935P(z>d)=0.9935, find d. C) For the standard normal distribution, find the value of c such that: P(z > c) = 0.3271 D)...
1) You graduate from college and get your first job. You open a Roth IRA with...
1) You graduate from college and get your first job. You open a Roth IRA with $2,000 at the age of 25. You invest $3,000 at age 26, $4,000 at age 27, and $5,000 at age 28. You then receive a promotion that brings your income to a level that disqualified you from making further contributions to the Roth IRA. Construct a table that shows how much will you have in your IRA at the age of 60 if you...
in c++ Write a C++ program that asks the user to enter an integer number and...
in c++ Write a C++ program that asks the user to enter an integer number and prints it back "vertically" to the screen. Use recursion in your solution. As an example of how the program will work: Please enter an integer: 12345 The integer you entered will print vertically as: 1 2 3 4 5
Can you please explain how can we find the 50th percentile point using this grouped frequency...
Can you please explain how can we find the 50th percentile point using this grouped frequency table? I know that it falls between scores of 56.4 % and 34.6% which corresponds to a score between 19.5 and 24.5. How can we find the exact 50th percentile point? what is the easiest way to do so? Is there a formula for that? INTERVALS FREQUENCIES RELATIVE FREQUENCIES CUMULATIVE FREQUENCIES CUMULATIVE PERCENTAGE 60-64 1 .01 78 100 55-59 1 .01 77 99 50-54...
Please answer all of these 2. Colin is 35 years old and inherits an IRA from...
Please answer all of these 2. Colin is 35 years old and inherits an IRA from his mother, who dies prematurely at age 60 in May 2020. Which of the following statements is correct regarding his options for the inherited IRA? a. Colin does not have to take distributions until he turns 70 years old b. Colin can rollover the IRA into his own IRA c. Colin can take out the entire distribution any time within 10 years and avoid...
Case Study #1: Planning a Healthy Vegetarian Diet Name: ________________________________ Please - put your name in...
Case Study #1: Planning a Healthy Vegetarian Diet Name: ________________________________ Please - put your name in the title of each document! Instructions: There are 4 parts to this case study. Read through the case below and then use the suggested resources to complete all 4 parts to submit by Wednesday of week 4. Then, using any feedback or additional insight from the week, make any necessary changes and submit a second version by the end of week 4. Post and...
(Please if possible, provide with example ages) 1. How to find point estimation of average age...
(Please if possible, provide with example ages) 1. How to find point estimation of average age with 95% confidence? 2. How to calculate margin of error with 95% confidence? 3. How to calculate interval estimate of the population mean? 4. What happens to confidence interval if confidence level would increase to 99%? Would co. int. be wider or more narrow?
You just turned 22 years old and want to retire when you turn 65. You plan...
You just turned 22 years old and want to retire when you turn 65. You plan to put $3,500 every year into a ROTH IRA, a retirement account from which you can withdraw money after retirement without having to pay any taxes. You expect to earn a return of 6% on your investments every year. Attempt 1/5 for 12 pts. Part 1 How much money can you expect to have at age 65 if you make your first annual deposit...