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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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