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

  Explain inheritance structures of galaga

Write a 3-page paper about inheritance structures of Galaga. Recognize the parent and child classes and describe what each class has for events and data.

  Write program that would estimate magnitude

Write a program that would estimate the magnitude (liters/day) and cost of the water saved based on the community's population.

  Create unix shell script to input number of hours worked

Create a Unix shell script to input number of hours worked and pay rate and compute the total pay, then the social security amount (assume 5%), then the net pay.

  Write a program that display amount of discount on item

Write a program that asks the user to enter number of packages purchased. Program must then display amount of the discount (if any) and total amount of the purchase after the discount.

  Compute the product xy

Given two integers X and Y compute the product XY (multiplication), the quotient X=Y (integer division), and the modulus X (mod Y) (remainder).

  Ways to ensure that website is easy to navigate

A good practice would be to spread the content out among several pages. What are some ways to ensure that your website is easy to navigate?

  User-s ability to navigate the web site correctly

This can paralyze a user's ability to navigate the Web site correctly. Examples include opening new browser windows or using meta-refresh to force a page.

  Statement to assig nnew value to first element of array

Suppose that array of integers named a has been declared and initialized. Write single statement which assigns a new value to first element of the array.

  Design program to list total points scored for classroom

Student ID, classroom number, and score on the achievement test. Design a program that lists the total points scored for each of the 30 classrooms.

  Create program for hollywood movie rating guide

Create a program for the Hollywood Movie Rating Guide,in which users continuously enter a value from 0 to 4 that indicates the number of stars they are awarding to the Guide's featured movie of the week.

  Create a dtd for a small xml data set

Create a DTD for a small XML data set drawn from the Stanford course catalog. There are multiple departments, each with a department chair.

  Questions on programing problem with the process of analysis

Questions on Programing Problem with the process of analysis and reflection that went on as you developed the project.

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