Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Topics: Entering, compiling, and running a Java program Using arithmetic expression &casting Using Scanner class for input Using the Math class Assignment Documentation: All submitted

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

Topics: Entering, compiling, and running a Java program Using arithmetic expression &casting Using Scanner class for input Using the Math class Assignment Documentation: All submitted assignments must begin with the descriptive comment block similar to the one shown below. It must contain your name and the other information illustrated. To avoid losing trivial points, make sure this comment header is included in every assignment you submit, and that it is updated accordingly from assignment to assignment STUDENT NAME: your name // FILENAME: title of the source file 77 DESCRIPTION: description of the program // FOR: CSE 110 - Homework Assignment #1 TIME SPENT: how long it took you to complete the assignment 77 DATE: the date you submitted this assignment on 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 /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/9)F - 32. public static void main (String[ args) [ //constant variables final int BASE = 32 final double CONVERSION_FACTOR5.09.0 //declare variables int fahrenheitTemp 24; // value to convert double celsiusTemp; celsiusTempfahrenheitTemp * CONVERSION_FACTOR BASE; System.out.println ("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: ntroduce 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 printin) statement. c. Change the constant CONVERSION FACTOR to 5/9 instead of 5.0/9.0. d. Change the variable name fahrenheitTemp to fahrenhei 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: Tn PVann- PMT1+ 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 xy. 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 For this and all subsequent assignments, provide a heading (in comments) described above and demonstrated in Program #1 . Make sure your program is called Assignment!.java

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

Algorithmic Trading Navigating The Digital Frontier

Authors: Alex Thompson

1st Edition

B0CHXR6CXX, 979-8223284987

More Books

Students also viewed these Databases questions

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago