Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Implementing using

class Loan


Sample Run:

Enter yearly interest rate, for example 8.25: 10

Enter number of years as an integer, for example 5: 5

Enter loan amount, for example 120000.95: 300000

The monthly payment is 6374.11

The total payment is 382446.80



Write a C++ program to find sum of all even numbers between 1 to n. – using for loop


Write a C++ program to print all even numbers between 1 to 100. - using while loop


Write a C++ program to print all natural numbers in reverse (from n to 1). The value n should be input by the user.- using while loop FLOWCHART & PSEUDOCODE


2.

Assume that each of the following statements applies to the same program.

a.

Write a statement that opens file

oldmast.dat

for

input; use an ifstream object called

inOldMaster.

b.

Write a statement that opens file

trans.dat

for reading

and writing data to it; use fstream object

transFile

that can read data from the file trans.dat

as well as write data to it.

c.

Write a statement that writes a record to the transfile. The record to store consist of an integer data

accountNumber

, and a floating point data

dollarAmount



1.Find the error(s) and show how to correct it(them) in each of the following.a.Filepets.datthat stores its id, name, age and ownerof the pet is referred to by ofstream objectpetfile.petfile>>pet_id>>pet_name>>pet_age>>pet_owner;b.The following statement should create an ifstream objectsalesfilethat refers to the fileweeklysales.datthat contains data about the id thesalesperson, total sales generated, and theweek number, read the data from the file and display it on the console output.ifstream salesfile(“weeklysales.dat”);int id,wk;float sales;salesfile>>id>>wk>>sales;while (!salesfile.eof()){cout<<id<<”\t”<<sales<<”\t”<<wk<<”\n”;salesfile<<id<<wk<<sales;}c.The salaries.dat should be updated to include the salary details of new employees. An ofstreamobject is created to refer to the file so new data can be added at the end of the file.ofstream salfile;salfile.open(“salaries.dat”,ios::out);


Find the error(s) and show how to correct it(them) in each of the following.

a.

File

pets.dat

that stores its id, name, age and owner

of the pet is referred to by ofstream object

petfile

.

petfile>>pet_id>>pet_name>>pet_age>>pet_owner;

b.

The following statement should create an ifstream object

salesfile

that refers to the file

weeklysales.dat

that contains data about the id the

salesperson, total sales generated, and the

week number, read the data from the file and display it on the console output.

ifstream salesfile(“weeklysales.dat”);

int id,wk;

float sales;

salesfile>>id>>wk>>sales;

while (!salesfile.eof()){

cout<<id<<”\t”<<sales<<”\t”<<wk<<”\n”;

salesfile<<id<<wk<<sales;

}



 Given a positive integer n, list all the bit sequences of length n that do not have a pair of consecutive 0s. Write a C or C++ program to solve this problem. The input is an integer n 

Run your program on the following six inputs: n = 6, 7, 8, 9, 10, 11


implement the class Loan with the following requirements:

A member variable that will hold the annual interest rate of the loan. Its default value will be 2.5.

A member variable that will hold the number of years for the loan. Its default value will be 1.

A member variable that will hold the loan amount. Its default variable will be 1000.

A default constructor.

Another constructor that has interest rate, years, and loan amount as its parameters.

A member function that returns the annual interest rate of this loan.

A member function that returns the number of the years of this loan.

A member function that returns the amount of this loan.

A member function that sets a new annual interest rate to this loan.

A member function that sets a new number of years to this loan.

A member function that sets a new amount to this loan.

A member function that returns the monthly payment of this loan


Using class Loan


Sample run:

Enter yearly interest rate, for example 8.25: 10

Enter number of years as an integer, for example 5: 5

Enter loan amount, for example 120000.95: 300000

The monthly payment is 6374.11

The total payment is 382446.80



LATEST TUTORIALS
APPROVED BY CLIENTS