Question

Given a Loan class, name the necessary fields and methods that we would need in this...

Given a Loan class, name the necessary fields and methods that we would need in this class. Be creative in your naming of variables and methods.

Homework Answers

Answer #1

class Loan{

//Data Members

public:

int loan_amount;

int month_interest;

int emi_number; //number of payments

//Methods

//constructor

Loan ( int amt, int rate, int num){

loan_amount = amt;

month_interest = rate;

emi_number = num;

}

//get loan amount

int getamt(){

return loan_amount;

}

//year tenure of loan

int getloan_period(){

return emi_number/12;

}

//monthly payment

double getemi(){

int x = (1+ month_interest)*emi_number;

double emia = loan_amount * month_interest*x/(x-1);

return emia;

}

};

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Create java class with name Dog. Instructions for Dog class:              This class is modeled after...
Create java class with name Dog. Instructions for Dog class:              This class is modeled after a Dog. You should have instance variables as follows: The Dog’s name The number of tricks known by the Dog. The color*of the Dog’s coat (fur). *: For the Dog’s fur color you should use the Color class from the java.awt package. You should choose proper types and meaningful identifiers for each of these instance variables. Your class should contain two constructor methods. A...
in jGRASP INVENTORY CLASS You need to create an Inventory class containing the private data fields,...
in jGRASP INVENTORY CLASS You need to create an Inventory class containing the private data fields, as well as the methods for the Inventory class (object). Be sure your Inventory class defines the private data fields, at least one constructor, accessor and mutator methods, method overloading (to handle the data coming into the Inventory class as either a String and/or int/float), as well as all of the methods (methods to calculate) to manipulate the Inventory class (object). The data fields...
public class Bicycle { // Instance variables (fields) private String ownerName; private int licenseNumber; // Constructor...
public class Bicycle { // Instance variables (fields) private String ownerName; private int licenseNumber; // Constructor public Bicycle( String name, int license ) { ownerName = name;    licenseNumber = license; } // Returns the name of the bicycle's owner public String getOwnerName( ) { return ownerName; } // Assigns the name of the bicycle's owner public void setOwnerName( String name ) { ownerName = name; } // Returns the license number of the bicycle public int getLicenseNumber( ) {...
Write a Python class, Flower, that has 3 instance variables name, num_petals and price which have...
Write a Python class, Flower, that has 3 instance variables name, num_petals and price which have types str, int and float. Your class must have a constructor method to initialize the variables to an appropriate value, and methods for setting the value of each instance variable (set methods) and for retrieving the instance variable values (get methods). You can use the credit card code we looked at for assistance.
Write the program in java Implement a class Product. Create instance variables to store product name...
Write the program in java Implement a class Product. Create instance variables to store product name and price and supply the values through constructor. For example new Product(“Toaster’, 29.95). Create methods, getName, getPrice. Write a method productPrinter that prints the product name and its price after reducing it by $5. Create a main class and necessary constructs in the main class to run the Product class.
Design a class with the following requirements: 1- give the class a name from your choice....
Design a class with the following requirements: 1- give the class a name from your choice. 2- write some code that creates three instance variables, choose a name and type for each one of them. (must have two private and one public variables) 3- Initialize the variables using two different constructors. 4- Use mutator and accessor methods (set and get) for the private data members. 5- Display the value of each member variable using a method. 6- In the main,...
Design a class with the following requirements: 1- give the class a name from your choice....
Design a class with the following requirements: 1- give the class a name from your choice. 2- write some code that creates three instance variables, choose a name and type for each one of them. (must have two private and one public variables) 3- Initialize the variables using two different constructors. 4- Use mutator and accessor methods (set and get) for the private data members. 5- Display the value of each member variable using a method. 6- In the main,...
Define a class named Employee that has four data fields: name: String hoursWorked: double hourlyPayrate: double...
Define a class named Employee that has four data fields: name: String hoursWorked: double hourlyPayrate: double bonusRate: double The class has two constructors: 1. constructor without arguments: initialize name to empty string, and all other data fields to 0.0 2. constructor with a String type arguments and three double type arguments. Use them to initialize the data fields properly The class also has: 1. Getter method for each data field to return the value of the data field 2. Setter...
1. Circle: Implement a Java class with the name Circle. It should be in the package...
1. Circle: Implement a Java class with the name Circle. It should be in the package edu.gcccd.csis. The class has two private instance variables: radius (of the type double) and color (of the type String). The class also has a private static variable: numOfCircles (of the type long) which at all times will keep track of the number of Circle objects that were instantiated. Construction: A constructor that constructs a circle with the given color and sets the radius to...
loanCreator.java: /* * Use constants when necessary, define with proper scope * * Create Person class...
loanCreator.java: /* * Use constants when necessary, define with proper scope * * Create Person class with data fields of firstName and lastName these fields can not change. * * Create Loan class with data fields of Person, loan Amount, term and interest rate * If term is not past in then default value is 36 * If interest is not past in then default value is 5.0 * * In Loan class create method to construct output String *...