Write error message and repeat input until a answer is found

Assignment Help Programming Languages
Reference no: EM131225415

Computer Science

Program-

Write all of the following:

main program:

Call a function to open an input file.
Call a function to read 3 integers in from the input file.
Call a function that will find 3 normalized doubles, given the 3 integer inputs.
Call a function to write out the 3 integers and the three doubles to an output file.
Call a function that will ask the user if they want to continue.
Repeat all of the following steps if the user chooses to continue.

openFile function:

Ask the user for the name of an input file.

Try to open this file. If the file is not found, ask for another name and try again. Repeat until an input file is successfully opened.
Send back a reference to the open file

getData function:

Given the open input file, read in 3 integer values and send them all back to the main program.

largest function:

Given 3 integer values, find the largest one, and send that one value back.

normalize function:

Given 3 integer values, call largest function to find which is biggest.

Divide each of the 3 integer values by the largest, resulting in 3 double values (i.e. inputs of 2, 3, 4 will give normalized values of 0.5, 0.75, 1.0).

Send back the 3 normalized double values.

output function:

Given: 3 integers and 3 doubles
Ask the user for the name of an output file
Open the output file for writing
Write out the 6 numerical values with some explanatory text
Close the output file

getOption function:

Ask the user if they want to continue.
Give the user specific instructions for what their answer should be (i.e. Y or N). If their answer is anything other than one of the specified choices, write an error message and repeat the input until a desired answer is found. (ex. If you ask for 0 or 1, then repeat until the user enters 0 or 1).

Send back the user's choice

The usual comments are required, plus write a description of each function's purpose before its definition. Submit printout and on Titanium.

Reference no: EM131225415

Questions Cloud

Discuss a current policy debate that you have started : Discuss a current policy debate that you have started to tune into more since this course started. Explain why you seem to be following it more closely and what you seem to be focused more on having taken this class.
What coping skills may help the client remain sober : What coping skills may help the client remain sober? What new activities could the client participate in to help replace old behaviors such as going out with his friends, for a drink, etc. after work?
Exploration of future inventions inspired by the product : Review the processes of invention and innovation. Then, select a new product that you have been introduced to in the past 12 months. Research this new product using outside sources. You must also choose a company that produce and/or sell this prod..
Determine the quiescent currents : Determine the quiescent currents IDQ1 and IDQ2. - Determine the small-signal current gain Ai = Io/Ii . - Derive the expression for the small-signal current gain Ai = Io/Ii .
Write error message and repeat input until a answer is found : Give the user specific instructions for what their answer should be (i.e. Y or N). If their answer is anything other than one of the specified choices, write an error message and repeat the input until a desired answer is found.
Compare and contrast it to your perspective on society today : Page length is 4-6 page double space. Watch an episode of the 70s sitcom "All in the Family." Compare and contrast it to your perspective on society today. Be sure to identify the exact episode and include the date and year the episode aired.
How can your company combat these strategies : Create a case study summary of the company you have chosen, including a general overview of the company, its external environment, and a list of its current strategies and objectives.
Are felony disenfranchisement laws of racial discrimination : I need literature Review Paper in APA format over this topic Are Felony Disenfranchisement laws a form of racial discrimination against African American? I need it to include 20 references sources which must be also included in the paper and also ..
Determining the change in interest rates : 1. All else equal, which bond's price is more affected by a change in interest rates, a bond with large coupon or a small coupon? Why?

Reviews

Write a Review

Programming Languages Questions & Answers

  How does the use of open source products associate to the

the use of open source products and solutions is a popular topic. what is open source? identify the open source

  Run the application

Running the application. Select Debug > Start Debugging to run your application. Test your application by checking one or more of the new services.

  Write a command to list all files in current directory

Rewrite the following sequence of commands using sort as a filter. The end result should be a single command line when you are done.

  Write program that compute the amount person earn

Write a program which computes the amount a person would earn over period of time if his or her salary is one penny the first day, two pennies second day.

  Write menu driven program that make coffee shop operational

Jason has opened a coffee shop at the beach and sells coffee in three sizes: small (9oz) medium (12oz) and large (15oz). Small cost is $1.75 medium costs $1.90 and large costs $2.00. Write a menu driven program that will make the coffee shop opera..

  Create a class called date that includes 3 instance variable

Create a class called Date that includes 3 instance variables-a month (type int), a day (type int), and a year (type int). Provide a constructor that initializes the 3 instance variables and assumes the values provided are correct.

  Write down program which declares integer variables

Write down complete program which declares the integer variable, reads value from the keyboard into that variable, andwrites to standard output variable's value, twice the value.

  Deisgn driver to test implementation elements to tree

Deisgn a driver to test your implementation. Add various elements to the tree, and then display elements in sorted order. Also, display minimum and maximum element.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  What are the advantages and disadvantages of a

what are the advantages and disadvantages of a manufacturing company owning and operating its own outbound warehouse

  Application to simulate functionality of gas-visual basic

Design the application which simulates functionality of gas pump. User enters number of gallons to buy and clicks desired grade (regular special super). Using Visual Basic.

  Create logic for program which contains housekeeping

Create logic for program in pseudocode or flowchart which contains housekeeping, detail loop, and end-of-job modules, and which computes service charge and the original check amount customers owe for writing bad check.

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