Write code to takes input from console

Assignment Help Programming Languages
Reference no: EM1369606

Write a code using C++ that takes input from the console and displays output on the console. You will write a program that takes user input, does some basic arithmetic, and displays the results.

The program should prompt the user for the number of seconds and the number of miles traveled. The program should convert the given number of seconds into different units of time and using the given total distance should report the average speed. The output should give the time in years/days/hours/minutes/seconds and the average speed in both miles per hour (mph) and feet per second (ft/s). You should use the conversions:

* 1 mile = 5,280 feet
* 1 year = 365 days
* 1 day = 24 hours
* 1 hour = 60 minutes
* 1 minute = 60 seconds

Sample output should be something like the text below, where the user entered 123456 seconds and 42 miles:

Enter the total time of the journey (in seconds): 123456

Enter the total distance traveled (in miles): 42

You have been travelling for 0 years, 1 days, 10 hours, 17 minutes, and 36 seconds.

Your average speed is 1.225 mph or 1.796 ft/s.

The only difference could be the number of decimal places you report. You may assume all time units are plural, so it's OK to say "1 days" or "1 years" as above. You are only allowed to use the material we've learned so far, so you are not allowed to use any if statements or loops.

Comments: As with all programs in this course, your code should contain useful comments. In particular, your name and a brief description of what the program does should appear at the top of your source file. Here is an example template, which you can use in your assignment:

Reference no: EM1369606

Questions Cloud

What appears to be major constraint that central banks used : What appears to be major constraint that central banks used to determine limits of monetary injections into economy. Did United States use same or different criteria.
Description of review : How would a degree in international relations assist me in furthering my career objectives as well as advances my understanding of the global geo-political landscape when running such a global corporations in multi continent.
Explain key multinational and local players : Explain Key multinational and local players in the target industry in the target country. Please provide detail information.
Show the welfare reform : What is welfare reform? Lawmakers in many states are trying to pass welfare reform orders to decrease women having children and people needing assistance.
Write code to takes input from console : Write code using C++ which takes input from console and displays output on console. You will write program which takes user input, does some basic arithmetic, and displays the results.
What is maximum amount it would be worth to shareholders : What is maximum amount it would be worth to shareholders to elicit high CEO effort all time rather low CEO effort all time.
Provide example of the prisoner dilemma : Nintendo and Sony Playstation are each considering to introduce one new game into the market. Each is planning three different kinds of games: an urban action game like Grand Theft Auto,
Explain what is the reliability of a measurement : Explain what is the reliability of a measurement and what is the validity of a measurement? Can a measurement wbe valid if it is not reliable? Explain.
Explain the project you are managing is a small one : Explain The project you are managing is a small one and Do you think it is necessary to review all of the risks in a Minor Review? Can you just do a sampling of them to see what is happening

Reviews

Write a Review

Programming Languages Questions & Answers

  Scripting language programming in perl

course Scripting Language Programming,  Assignment   -  Perl,  ? Your coding style should conform to general Perl coding conventions. Your scripts should be clean, neat, and well-formatted (e.g. indention). Identifiers should also be properly name..

  Specific changes made for different countries-sites directed

Why were these specific changes made for different countries at whom the sites were directed? Is there anything else you would consider changing.

  Program to inputs encrypted four-digit integer

Write separate program to inputs encrypted four-digit integer and decrypts it to form the original number. thanks in advance for ur help.

  Develop the algorithms needed for designer robot

You have been hired as a system designer to develop the algorithms needed for a designer robot that can paint different patterns on the floor based on the commands it receives.

  Design logic for application for company-breakdown-payroll

Design the logic for an application for a company that wants a report containing a breakdown of payroll by department.

  Write a program to create three identical list

Write a program to create three identical list, list1, list2, and list3, of 5000 elements. The program then sorts list1using quick sort, list 2 using insertion sort.

  Write program to calculate distance and time hurricane take

Write C++ program that will calculate the distance and time it will take (days/hours) for hurricane to reach Ft. Lauderdale if: Hurricane is at coordinates 16 N, 64 W, just SE of South Fla. off in Atlantic, with a speed of 20 mph.

  Creating website-based sales system for retail firm

Assume that you have been hired to create website-based sales system for large international retail sales firm.

  Program to calculate volume flow rate in cubic feet

Write a program to calculate the volume flow rate in cubic feet per second of water flowing through a pipe of diameter d in inches and a velocity of v feet per second.

  Program has function named presentvalue for calculations

Write a program that has a function named presentValue that performs this calculation. The function should accept the future value, annual interest rate, and number of years as arguments.

  Write program to prompt user to enter string of caharacter

Write a program that prompts the user to enter a string of 87 characters the program should display the middle character in the string if there is an odd number characters in the string.

  Write program to compute student-s quiz average

Write a program that will compute student's quiz average. Program must prompt the user for the number of quizzes and then ask the user for each quiz grade.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd