Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: Program #1 Compile and Run: (5 pts) Type the following code into a file called TempConverter.java. After the program is entered, compile and

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Part 1: Program #1 Compile and Run: (5 pts) Type the following code into a file called TempConverter.java. After the program is entered, compile and run the application to make sure it works. Once you see it working correctly, answer questions a - e below. The comment block bellow is a good example to base yours off of for Part 2 below. You DO NOT have to submit this TempConverter.java file, but you will need to include your answers to questions a e at the end of your comment block in your Assignment1.java file // NAME Phillip Miller / FILENAME: TempConverter.java // DESCRIPTION: This program converts a Celsius value to Fahrenheit, then displays both values // FOR: CSE 110 - Homework Assignment #1 I/ TIME SPENT: 20 minutes DATE: 1/12/2919 public class TempConverter // Computes the Celsius equivalent of a specific Fahrenheit // value using the formula C- (5/9OF -32 public static void main (String args) //constant variables final int BASE32; final double CONVERSION_FACTOR5.0/9.0 //declare variables int fahrenheitTemp24; // value to convert double celsiusTemp celsiusTempfahrenheitTemp CONVERSION FACTOR BASE; System.out.println C"Celsius Temperature:"celsiusTemp); System.out.println ("Fahrenheit Equivalent: "+ fahrenheitTemp); There are numerous opportunities for errors in any program, many times in places that seem too simple to require close attention. Questions: Introduce the following errors, one at a time, in the program TempConverter.java. Then compile the program. Write in your own words any error messages that the compiler produces. Fix the previous error each time before you introduce a new one. If no error messages are produced, try to run the code and explain what happens. If still no errors are produced, explain why. a. Change TempConverter to tempConverter b. Remove the semicolon at the end of the first println() statement. c. Change the constant CONVERSION_FACTOR to 5/9 instead of 5.0/9.0. d. Change the variable name fahrenheitTemp to fahrenheit in any one place in the code. e. Change the variable name BASE to base. Note: The answers to the 5 questions (a through e) above should be typed in the block of comments in the Assignment1.java file. Part 2: Present Value of an Annuity (15 pts) Overview: An annuity (sometimes called a reverse mortgage) is an account that yields a fixed payment every year until it is depleted. The present value of the annuity is the amount that you would need to invest at a given interest rate so that the payments can be made The present value of an annuity (PVann) at the time of the first deposit can be calculated using the following formula: where: PMT is the periodic payment i is the periodic interest or compound rate n is the number of payments Write a program that asks user to enter the values for pmt, i, and n from the keyboard and computes the present value of an annuity for these values. Remember that you can use Math.pow(x, y) to calculate x Here are some sample runs, with user input is in red. Sample Run 1 Enter the periodic payment (PMT): 10000 Enter the interest rate (i): 8 Enter the number of payments (n): 20 11250.0 Sample Run 2 Enter the periodic payment (PMT): 120 Enter the interest rate (i): 5 Enter the number of payments (n): 100 144.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

Explain methods of metal extraction with examples.

Answered: 1 week ago

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago