QuestionQuestion

1. (upload as source) Write a program which asks the user to enter his or her age. The program then should display the age in the months.
Prompt: Enter your age: 29
Output: Your age in months is 384

2. (upload as source) Write a program that takes a distance in light years as an argument and then returns the distance in astronomical units. The program should request the light year value as input from the user and display the result, as shown below:
Prompt: Enter the number of light years: 4.2
Output: 4.2 light years = 265608
1 Light Year = 63,239.7263 Astronomical Units

3. (upload as source) Write a program that asks the user to enter the number of seconds as an integer value, and that then displays the equivalent time in the number of hours in the day, the number of minutes in an hour, and the number of seconds in a minute. The output should look like this:
Prompt: Enter the number of seconds: 31600000
Output: 31600000 seconds = 365 days, 17 hours, 46 minutes, 40 seconds

4. (Upload as Source) Write a program that asks the user to enter an hour value and a minute value. The main() function should then pass these two values to a type void function that displays the two values in the format shown in the following sample run:
Enter the number of hours: 9
Enter the number of minutes: 28
Time: 9:28
ECE - 222
Spring 2015
Page 2 of 2

5. (Upload as Source) Write a program that asks the user to enter the cost of an item, and the payment made for the item. The main() function should then pass these two values to a type float function which calculates and returns the change. The main() shall then display the change in the following format:
Enter the cost of the item: 2.54
Enter the payment for the item: 4.00
Change is 1.46

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

1.

int main(int argc, char** argv) {
    int age;
    cout<<"Enter your age: ";
    cin>>age;
    cout<<"Your age in months is "<<age * 12<<"\n";
   
    return 0;
}...
$15.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Visual Basic Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats