wo question in code ple
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
Related questions
Question
Two question in code please do asap.
![The output from your program should look like the following:
run:
Car Loan with:
Principal: $25000.00
Annual Interest Rate: 4.25%
Term of Loan in Months: 72
Monthly Payment: $393.98
Vehicle VIN: IRQ3458977
Primary Mortgage Loan with:
Principal: $250000.00
Annual Interest Rate: 3.10%
Term of Loan in Months: 360
Monthly Payment: $1067.54
PMI Monthly Amount: $35.12
Property Address:
321 Main Street
State College, PA 16801
Unsecured Loan with:
Principal: $5000.00
Annual Interest Rate: 10.75%
Term of Loan in Months: 48
Monthly Payment: $128.62](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe30badf0-530e-48d8-80be-0fdb11dd399b%2F80739fce-8541-4b4d-a130-b94478697f6e%2F37nik4i_processed.png&w=3840&q=75)
Transcribed Image Text:The output from your program should look like the following:
run:
Car Loan with:
Principal: $25000.00
Annual Interest Rate: 4.25%
Term of Loan in Months: 72
Monthly Payment: $393.98
Vehicle VIN: IRQ3458977
Primary Mortgage Loan with:
Principal: $250000.00
Annual Interest Rate: 3.10%
Term of Loan in Months: 360
Monthly Payment: $1067.54
PMI Monthly Amount: $35.12
Property Address:
321 Main Street
State College, PA 16801
Unsecured Loan with:
Principal: $5000.00
Annual Interest Rate: 10.75%
Term of Loan in Months: 48
Monthly Payment: $128.62
![public class IQANACCOUNE (
// properties
// private instance variable principal
private double principal;
//static variable "annualInterestRate"
private static double annual InterestRate:
// constructor
public LoanAccount double Principle) {
principal Principle;
{
}
// method called calculateMonthlyPayment
public double calculateMonthly Payment(int numberofRavmenta) (
double monthlyinteresat = annualinterestRate / 12:
double monthlyPayment
principal
Math Bowl + monthlvinterest, -numberofRaTENFR) ) );
return monthlyPayment:
}
(monthivinterest / (1 -
// a static method serAnnualInterestBate
public static void setannualInterestRate(double AnnualInterestRate)
annualInterestRate = AnnualInterestRate:
}
public static void main(String[] args) {
// principal loan amounts of $5000.00 and $31000.00
double principlelAmount = 5000, principle2Amount = 31000:
// Instantiate two loan objects
LoanAccount, loan1 = new LoanAccount (principlelAmount);
LoanAccount, loan2 = new IQARAGGOURE (principle2Amount);
// display results
SKAREM QUE DEÍn("Monthly payments for loanl of $%.2f and loan2
$%.2f for 3, 5, and 6 year loans at 1 & infexeshin”,
principlelAmount, principle 2 Amount);
// Set annualIntexestrate to 1%,
serAnnualInterstate (0.01);
System.out.println("Loan 3 years 5 years 6 years"
// calculate the monthly payment for each loan for 36 months, 60
months, and 72 months and print the monthly payment amounts for both
loans.
Skatem.que Brinkf("Loan1 .2 %.2f $.2f\n",
loanl.calculateMonthlyPayment (3 * 12),
loanl.calculateMonthlyPayment (5 * 12),
loanl.calculateMonthlyPayment (6 * 12)):
Skatem. QUEDEINEE("Loan2.2 %.2f $.2f\n",
n2.calculateMonthlyPayment (312),
loan2.calculateMonthlyPayment (5 * 12),
loan2.calculateMonthlyPayment (6 * 12):
Skatem.out.prİNER("Monthly payments for loan1 of $%.2f and loan2.
$%.2f for 3, 5, and 6 year loans at 5 & interestin",
principlelAmount, principle 2 Amount);
// set the annualIntexestRate to 5%
}
serAnnualInterestRate(0.05);
Svatem.out.println("Loan
3 years 5 years 6 years"):
Skatem que printf("Loani .21 %.2f $.2fin",
loanl.calculateMonthlyPayment (312),
loanl.calculateMonthlyPayment (5 * 12),
loan1.calculateMonthlyPayment (6 * 12):
Skatem. Que printf("Loan2 .2f $.2f $.2f%n",
loan2.calculateMonthlyPayment (3 * 12),
loan2.calculateMonthlyPayment (5 12),
loan2.calculateMonthlyPayment (6 * 12):
(Ctrl)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe30badf0-530e-48d8-80be-0fdb11dd399b%2F80739fce-8541-4b4d-a130-b94478697f6e%2F3sgy3y_processed.png&w=3840&q=75)
Transcribed Image Text:public class IQANACCOUNE (
// properties
// private instance variable principal
private double principal;
//static variable "annualInterestRate"
private static double annual InterestRate:
// constructor
public LoanAccount double Principle) {
principal Principle;
{
}
// method called calculateMonthlyPayment
public double calculateMonthly Payment(int numberofRavmenta) (
double monthlyinteresat = annualinterestRate / 12:
double monthlyPayment
principal
Math Bowl + monthlvinterest, -numberofRaTENFR) ) );
return monthlyPayment:
}
(monthivinterest / (1 -
// a static method serAnnualInterestBate
public static void setannualInterestRate(double AnnualInterestRate)
annualInterestRate = AnnualInterestRate:
}
public static void main(String[] args) {
// principal loan amounts of $5000.00 and $31000.00
double principlelAmount = 5000, principle2Amount = 31000:
// Instantiate two loan objects
LoanAccount, loan1 = new LoanAccount (principlelAmount);
LoanAccount, loan2 = new IQARAGGOURE (principle2Amount);
// display results
SKAREM QUE DEÍn("Monthly payments for loanl of $%.2f and loan2
$%.2f for 3, 5, and 6 year loans at 1 & infexeshin”,
principlelAmount, principle 2 Amount);
// Set annualIntexestrate to 1%,
serAnnualInterstate (0.01);
System.out.println("Loan 3 years 5 years 6 years"
// calculate the monthly payment for each loan for 36 months, 60
months, and 72 months and print the monthly payment amounts for both
loans.
Skatem.que Brinkf("Loan1 .2 %.2f $.2f\n",
loanl.calculateMonthlyPayment (3 * 12),
loanl.calculateMonthlyPayment (5 * 12),
loanl.calculateMonthlyPayment (6 * 12)):
Skatem. QUEDEINEE("Loan2.2 %.2f $.2f\n",
n2.calculateMonthlyPayment (312),
loan2.calculateMonthlyPayment (5 * 12),
loan2.calculateMonthlyPayment (6 * 12):
Skatem.out.prİNER("Monthly payments for loan1 of $%.2f and loan2.
$%.2f for 3, 5, and 6 year loans at 5 & interestin",
principlelAmount, principle 2 Amount);
// set the annualIntexestRate to 5%
}
serAnnualInterestRate(0.05);
Svatem.out.println("Loan
3 years 5 years 6 years"):
Skatem que printf("Loani .21 %.2f $.2fin",
loanl.calculateMonthlyPayment (312),
loanl.calculateMonthlyPayment (5 * 12),
loan1.calculateMonthlyPayment (6 * 12):
Skatem. Que printf("Loan2 .2f $.2f $.2f%n",
loan2.calculateMonthlyPayment (3 * 12),
loan2.calculateMonthlyPayment (5 12),
loan2.calculateMonthlyPayment (6 * 12):
(Ctrl)
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning