Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

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

Create a program that will compute the simple interest loans in the bank. The program will ask the user to input the principal amount , the rate per annum and the time (in years).




Given the formula:




Interest = Principal Amount * RateperAnnum * Time / 100



Design a Car model class under package :package6 with the following attributes:



Member Field Name



Type



licenceNumber



String



Model



String



currentMileage



Double



engineSize



Integer



Mark at the attributes as private & create appropriate Getters & Setters



Design another class as Main under package :package6, where you need to implement logic as follows:



Declare an array as Car with size 10.



Take 10 Car's information from user and store them in specified array.



Call findCarList method from Main class to get all cars information related to Current Mileage engine Size values should to findCarList method as argument well as Car array (with size 10).



findCarList method Car class follows:



will take current Mileage engine Size as (with size 10)



displays List of than current Mileage and engine Size (both) for the given current Mileage engine values.



there are cars, then shows cars found".

Design a Car model class under package :package5 with attributes:


Member Field Name


Type


licenceNumber


String


Model


String


currentMileage


Double


engineSize


Integer


Mark all the attributes as private & Create default & parameterized constructors.


Design another class as Main under package :package5, where you need to implement logic as follows:


Declare an array as Car with size N, where N is to be accepted from user.


Take N Car's information from user and store them in specified array.


Call sortCarList method from Main class to get all cars information sorted based on Model name and display then within Main class after returning back from the specified method.


• From Main class car array need to pass within sortCarList method which return sorted car array and then display all car information on console.


Design sortCarList method in Car class as follows:


• it will take a car array ,return car array


it will sort array based on model value given in each car as its information.

Design aCar model classunder package :package4 with the following attributes:



Member Field Name



Type



licenceNumber



String



Model



String



currentMileage



Double



engineSize



Integer



Mark all the attributes as private & create appropriate Getters & Setters



Design another class as Mainunder package :package4, where you need to implement logic as follows:



Declare an array as Car with size 10.



Take 10 Car's information from user and store them in specified array.



Call findCarList method from Main class to get all cars information related to a given model name and display then within this method.



Model name should be taken from Main class and pass to find CarList method as argument as well as Car array (with size 10).



Design findCarList method in Car classas follows:



• it will take a model(car model) as parameter and array of cars (with size 10)



• displays List of cars for the given model from the list.



• If there are no cars, then shows "No cars found".

Design a Car model class under package :package3with the following attributes:



Member Field Name



Type



licenceNumber



String



model



String



currentMileage



Double



engineSize



Integer



Mark all the attributes as private & create appropriate Getters & Setters



Design another class as Mainunder package :package3, where you need to implement logic as follows:



You need to take the number of cars as input and then take each car's necessary information and put them in array.



Then at end show them in well-designed format.



Create a class named as Customerunder package :package2, which contains following private variables/ attributes,




Member Field name




Type




id




Long




name




String




gender




Character (M/F)




email




String




contact Number




String




Mark all the attributes as private




Add a default constructor and a parameterized constructor to take in all attributes.




Create a separate class Main under package :package2, within it's main() method, make 2 Customer objects and then compare between these Customers.




Two members are considered same if they have same email and contactNumber. Implement the logic in the appropriate function. (override equals method in class Customer)



Sample Input:




Customer1:




ld: 45




Name: John




Gender: M




Email: john@a.com contact number: +997-4854-7485965123




Customer2:




ld: 12




Name: Marc




Gender: M




Email: marc@a.com




Contact number: +997-4854-7485965123




Sample Output:




Customer 1 and Customer 2 are different

Create a class named as Customer under package :package1, which contains following private variables/ attributes,




Member Field name




Type




id




Long




name




String




gender




Character (M/F)




email




String




contactNumber




String




Mark all the attributes as private




Create / Generate appropriate Getters & Setters.




When the "customer" object is printed, it should display the following details: (override to String method)




. Customer: name




. Customer contact details: contact Number, email



Refer Sample Input and Outputs.




HINT:




Please print customer id in the Main class.




The toString method should print as specified in the problem statement [Name and contact details alone]




Sample Input:




Enter Customer Details:




ID: 45




Name: John




Gender: M




Email: john@a.com



Contact number: +997-4854-7485965123




Sample Output:




Customer id 45




Customer: John




Customer contact details:+997-4854-7485965123,

Instruction:

Create a Java Program that will accept two values.

Determine if the two argument lists are identical or not.

Sample IO #1:

Sample Input:

Name1: Jose

Birthday: 1-1-2000

Name2: Jose

Birthday: 1-1-2000

Output:

IDENTICAL

Name: Jose

BirthDate: 1-1-2000

Name: Jose

BirthDate: 1-1-2000


Sample IO #2:

Sample Input:

Name1: Jose

Birthday: 1-1-2000

Name2: Jose

Birthday: 6-7-2012

Output:

NOT IDENTICAL

Name: Jose

BirthDate: 7-6-2000

Name: Jose

BirthDate: 6-7-2012


MyDate Class

Attribute/s: private int day, month, year;

Constructor/s:

public MyDate(int month, int day, int year)

Method/s:

Setters and getters, public boolean equals(Object o);

public int hashCode(); and

public String toString()



Person Class

Attribute/s: private String name; private MyDate dob;

Constructor/s:

public Person(String name, MyDate dob)

Method/s: Setters and getters,

public boolean equals(Object o);

public int hashCode(); and

public String toString()


Your Test class named TestPerson


2. Write a Java program without using a second array to reverse elements of each row of a 2-d array of integer values.




e.g. 1 2 3 4 4 3 2 1




5 6 7 8  8 7 6 5




9 10 11 12 12 11 10 9





3. Write a java program to print the Pascal’s Triangle using a 2-d array.





4. Write a Java program to convert an array to an ArrayList, and an ArrayList to an array.





5. Write a Java program to arrange the elements of a given array of integers where all negative integers appear before all the positive integers.





6. Given two sorted arrays A and B of size p and q, write a Java program to merge elements of A with B by maintaining the sorted order i.e. fill A with first p smallest elements and fill B with remaining elements

Write a program to count the number of times a given integer appears in a LL.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS