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

  Select the names and average salaries for all departments

Employee table contains the following fields: ID, firstname, lastname, deptid, managerid, projectid.

  Pseudocode of program that will prompt user for number

Write pseudocode and flowchart for a program which will prompt user for a number, prompt the user for an operator (+,-,*,/), prompt the user for another number.

  A brief descriptionof the given project

A brief description, this is basically for my school final year project. So it need not to be very professional. I just need the outcome to be something like the ppt slides will do.

  Return boolean value true if string in array is palindrome

Write the recursive method testPalindrome which returns boolean value true if string stored in array is palindrome and false otherwise. Method must ignore spaces and punctuation in string.

  Create application which simulates functionality of gas pump

Create application which simulates functionality of gas pump. The user enters number of gallons to buy and clicks desired grade.

  Write program a childs selection game

Programing C a child's selection game

  Define features behind the design of a programming language

For example, an if-statement is only interesting if it has unique syntax or semantics. On the other hand, the absence of a common syntactic structure like an if-statement is interesting to note.

  Create command line based application for perfect hundred

Create a COMMAND LINE based application to play a game called Perfect Hundred. In this game, the user/player competes against the computer.

  Create a program that demonstrates the core algorithms

Create a program that demonstrates the core algorithms that will prototype the general operation of the application.

  Write program to accept data in array with three structures

Develop and make a program which will accept above data in array with three structures. Once data have been entered, display report listing each employee number and salary of employee.

  Write a perl program that given a dna string

Write a Perl program that given a DNA string, prints out the 20 characters upstream of the start codon ATG

  Create a rexx program

Create a REXX program that asks a user for four separate lines of input, and then outputs those lines all at once, one line at a time

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