This is for Coral.
Sites like Zillow get input about house prices from a
Output the estimated monthly mortgage (estMortgage) with two digits after the decimal point, which can be achieved as follows:
Put estMortgage to output with 2 decimal places
Ex: If the input is:
200000 210000
the output is:
This house is $200000. The change is $-10000 since last month. The estimated monthly mortgage is $750.00.
Note: Getting the precise spacing, punctuation, and newlines exactly right is a key point of this assignment. Such precision is an important part of
The code I have written is:
integer currentPrice
integer lastMonthsPrice
integer changeSinceLastMonth
integer estMortgage
currentPrice = Get next input
lastMonthsPrice = Get next input
changeSinceLastMonth = currentPrice - lastMonthsPrice
estMortgage = (currentPrice * 0.045) / 12
Put "This house is $" to output
Put currentPrice to output
Put ". The change is $" to output
Put changeSinceLastMonth to output
Put " since last month.\n" to output
Put "The estimated monthly mortgage is $" to output
Put estMortgage to output
Put "." to output
However the output does NOT have the two digits after decimal in the estMortgage variable. (IE $750.00) How do I fix this?
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
- Computer Science Write a Java program that reads a line and a line segment and then determines whether they intersect or not. When they overlap completely, consider that as intersecting. Use variables ((lp1x, lp1y), (lp2x, lp2y)) to represent a line and ((sp1x, sp1y), (sp2x, sp2y)) to represent a line segmentarrow_forwardUsing the Java language, write a program that takes two words as input from the keyboard, representing a password and the same password again. For example,websites ask users to type their password twice when they register to make sure there was no typo the first time around. Use the conditional operator when evaluating the password.arrow_forwardOn a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of fo* r, where n is the distance (number of keys) from that key, and r is 21/12) Given an initial key frequency, output that frequency and the next 3 higher key frequencies. Output each floating-point value with two digits after the decimal point, then the units ("Hz"), then a newline, using the following statement: printf("$0.21f Hz\n", yourValue); Ex: If the input is: 440.0 (which is the A key near the middle of a piano keyboard), the output is: 440.00 Hz 466.16 Hz 493.88 Hz 523.25 Hz Note: To compute the next 3 higher key frequencies, use one statement to computer = 2(1/12) using the pow function (remember to include the math library). Then use that r in subsequent statements that use the formula f = f0 *r¹ with n being 1, 2, and finally 3. O Run v main.c 1 2 3 int main(void) { #include Reset Lab Tutorial Ⓡarrow_forward
- Need help with this. Write a program named RepeatedDigits.java that asks the user to enter a number to be tested forrepeated digits. For each input number from user, the program prints a table showing how manytimes each digit appears in the number. Let’s assume that the appearance of a digit will not beover 1000 times in the input. Make sure your table printout can align well.The program should terminate when the user enters a number that is less than or equal to 0.arrow_forwardWrite a Java program that will use while loops. The while loop will show the cards currently in the hand and ask the user to accept a card (Hit) or to stop (Stand). Within the while loop the program should print the card that was just added, all the cards in the hand, and the new value of the hand. If the value of the hand exceeds 21, the game should end (the while loop should stop). Write out the algorithm for the while loop. Turn in a printout of the algorithm, the code and a printout of a sample run. Place the algorithm and the sample run inside comment blocks in the code. "The sample runs of such a program are on the attached image."arrow_forwardWrite a Java program that allows the user to enter the expenses’ in term of AED by using a while loop to calculate the average. The number of expenses is unknown. To stop entering the expenses, the user needs to enter a negative value. Show the total, average and the count.arrow_forward
- Write a program to handle a user's rolodex entries. (A rolodex is a system with tagged cards each representing a contact. It would contain a name, address, and phone number. In this day and age, it would probably have an email address as well.) Typical operations people want to do to a rolodex entry are: 1) Add entry 2) Edit entry 3) Delete entry 4) Find entry 5) Print all entries 6) Quit You can decide what the maximum number of rolodex entries is and how long each part of an entry is (name, address, etc.). When they choose to edit an entry, give them the option of selecting from the current rolodex entries or returning to the main menu — don't force them to edit someone just because they chose that option. Similarly for deleting an entry. Also don't forget that when deleting an entry, you must move all following entries down to fill in the gap. If they want to add an entry and the rolodex is full, offer them the choice to return to the main menu or select a person to overwrite. When…arrow_forwardWrite a program that reads a string (password) and a number. The maximum number of attempts (3). The program with stop asking data if the word ‘quit’ is provided in the password value. If user provide correct credential the message access granted will be displayed otherwise the message access denied with be generated.arrow_forwardWrite a program that accomplishes these tasks in Javaarrow_forward
- Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first five letters of the last name, followed by the first letter of the first name, and then the last two digits of the number (use the % operator). If the last name has less than five letters, then use all letters of the last name. Hint: Use the to_string() function to convert numerical data to a string.arrow_forwardWrite a program to understand customer waiting time. A list provides the number of customers that arrive every minute for 10 minutes. The program should output the length of the line at each minute, assuming one clerk serves each customer and takes 1 minute to complete service. If the input is 2 0 0 2 1 0 0 0 1 0, the output should be 2 1 0 2 2 1 0 0 1 0 (At minute 0, 2 customers arrived in line. At minute 1, 1 of those has been served, reducing the line to 1. At minute 2, that customer was served, reducing the line to 0). Output a space after each output integer, including the last (followed by newline). Hints: Every minute, if the lineLength wasn't 0, you can decrement lineLength because the clerk would have finished serving one customer. Every minute, if new customers arrived, just add them to lineLength for that minute.arrow_forwardCoral lang!!! Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (currentPrice * 0.045) / 12. Ex: If the input is 200000 210000, the output is: This house is $200000. The change is $-10000 since last month. The estimated monthly mortgage is $750.0. Note: Getting the precise spacing, punctuation, and newlines actly right is a key point of this assignment. Such precision is an important part of programming.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education