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 to use bit vector to represent dynamic set of distinct

Explain how to use a bit vector to represent a Dynamic Set of Distinct Elements with no Satellite Data. Dictionary Operations must Run in O (1) Time.

  Design program that asks user to enter budgeted amount

"Design a program that asks the user to enter the amount that he or she has budgeted for a month. (For example: $2,000.00)

  Write a function named dietoss

Write a function named dieToss that simulates the tossing of two dice. When you call the function, it should generate two random numbers ranged in 1 to 6 and return the sum of the die's numbers.

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Program to display weekly payroll report

Write down a program to display a weekly payroll report.

  Write function template which accepts array

Write a function template arraySum () which accepts array and number of values stored in it and returns the sum of those values.

  Write a prolog relation subsequence

Write a Prolog relation remove(E,L,R) that is true if R is the list which results from removing one instance of E from list L. The relation is false if E isn't a member of L.

  Write program two functions to solve problem of university

Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members.

  Artificial intelligence include expert systems,neural n/w

Are there ethical concerns here? How about ethical concerns for gathering and using competitive intelligence?

  Design a c# windows phone 8 application

Design and implement a C# Windows Phone 8 application based on the SoundBoard app in the Windows Phone 8 Development for Absolute Beginners textbook.

  Construct a diagram using rationaleto map the arguments

Construct a diagram using Rationaleto map the arguments about a moral claim that you have identified in the article/case study

  Program that prompts the user to input the dimensions

Amanda and Tyler opened a business that specializes in shipping liquids, such as milk, juice, and water, in cylinderical containers. The shipping charges depend on the amount of liquid in the container.

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