Ask Question, Ask an Expert


Ask Programming Language Expert

problem 1) You would create a program that would do temperature conversions, from Celsius to Fahrenheit, and from Fahrenheit to Celsius. Your program will read input from a text file named “temps.txt”. This file would contain the following information:

• A letter, ‘c’ or ‘f’, which indicates type of the temperature given

• The temperature itself your main function will read data from the file. Your program would have 2 functions:

i) One function to validate the data. Temperatures can’t be below absolute zero. Look up the temperatures for Celsius and Fahrenheit representations for absolute zero. If temperature given is below this threshold, then you must return a flag back to main() which indicates this.

ii) Other function to do all conversions. This function should be of type void, and would be called temp_convert. If the letter read from the file is ‘c’, then you must convert to Fahrenheit. If the letter read is ‘f’, then you must convert to Celsius. There should be NO return statements in this function.

Continue to read data from the file until you run out of data: don’t count how many lines of data there are and make your reading dependent on that. Consider: if different-length input file was run against your code, will your project break? Your project must be able to run input files of all lengths. Output the results in the well-formatted table. You would have a column of Celsius temperatures, and a column of Fahrenheit temperatures. If any temperature was below the absolute zero threshold, then the table must say “Too Cold!” where the conversion would have otherwise been. (Use your “flag” from above to execute this.) Make use of formatting methods we have discussed this semester to make your columns straight and even.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M94645

Have any Question? 

Related Questions in Programming Language

Handling exceptions in the guestbook applicationgeneral

Handling Exceptions in the Guestbook Application General guideline In this project, you will need to implement exception handling mechanism in the Guestbook application created in Lab. The code I provide to you does not ...

Programming logic and design questions1 given the

Programming Logic and Design Questions 1 given the following pseudocode module header: module calculate something (real x,real y, real z,) when the following call executes: call calculate something (21.6, 43.1, 15.2) sho ...

1 solve a simple payroll calculation find amount of pay

1. Solve a simple payroll calculation. Find amount of pay given hours worked and hourly rate. (pay = hourly rate * hours worked.) Run this values (hours = 30 and rate = 8.52) and with (hours = 53 and rate = 11.54). Show ...

Write a program that will predict the size of a population

Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms, their average daily population increase ( as a percentage), and the number of days the ...

Design and implement your own simple class to represent any

Design and implement your own simple class to represent any household item of your choice (toaster, fan, hair dryer, piano ...) Your class should have a constructor, one additional method and at least one member variable ...

Assignmentafter informing the user what the program does

Assignment After informing the user what the program does, prompt the user for the number of darts to throw. Also, prompt for a number of simulations (why not have the program simulate this dart throwing more than once). ...

Question 1 batteriesi want to use a galvanic cell to power

Question 1: Batteries I want to use a galvanic cell to power a 60-watt light bulb. Complete the following steps to determine how long the galvanic cell will power the light bulb before running out. a.) The galvanic cell ...

Design a class named pet which should have the following

Design a class named Pet, which should have the following fields: •Name - The name field holds the name of a pet. •Type - The type field holds the type of animal that is the pet. Example values are "Dog", "Cat", and "Bir ...

Generate code for the following three-address statements

Generate code for the following three-address statements assuming stack allocation where register SP points to the top of the stack. call p call q return call r return return

Assignmentinstructionsfor formload display use a textbox

Assignment Instructions: For Form_Load display, use a textbox and check its "multiline" checkbox. To display data on Form_Load, use a txtOutput. AppendText() method (i.e. NOT a listbox control). 1. Declare a global array ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

WalMart Identification of theory and critical discussion

Drawing on the prescribed text and/or relevant academic literature, produce a paper which discusses the nature of group

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro