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

Sam runs a local musical equipment store in your neighbourhood. He has contracted you to create

an interactive application that will assist him with customer purchases. Create a class named

Customer Purchases that will contain get and set methods for a customer number, first name,

surname, product, price and quantity. Create a separate class called Printing that will include a

method called Print Details, that will print the Customer Invoice. In the Printing class include

another method called Customer Purchase Report which will display the following information:


Can we not use an object of the Parent Class in the Child Class and use all its features?


Q2

Consider the following classes:

public abstract class Cat {

private int age;

private double weight;

private double top_speed;

public void run(double newSpeed) { ... }

private void eat(double portionSize) { ... }

// ... -> getXXX() and setXXX() methods here } 

}

public class Cheetah extends Cat {

private String type;

public Cheetah(int age, double wt, double sp, String type) {

this.type = type;

setAge(age);

setWeight(wt);

setTopSpeed(sp);

}

private void run(double newSpeed) { ... }

public void camouflage() { ... } // ... ->

//

getXXX()

//

and setXXX() methods here }

}

Which design principles are violated by these classes? Explain it and then correct it



Consider the following classes:


public abstract class Cat {

      private int age;  private double weight;    private double top_speed;

     public void run(double newSpeed) { ... }

     private void eat(double portionSize) { ... }

// ... -> getXXX() and setXXX() methods here }  

}

public class Cheetah extends Cat {

 

 

}

private String type;

public Cheetah(int age, double wt, double sp, String type) {       this.type = type;  setAge(age);      setWeight(wt);       setTopSpeed(sp);

} private void run(double newSpeed) { ... }

public void camouflage() { ... } // ... ->

//    getXXX()

//    and setXXX() methods here }


Which design principles are violated by these classes? Explain it and then correct it

B. Identify a real-world scenario for the below task:6 A task where the next one to work on is always the one that has been waiting the longest. i. For the above task, explain your choice of an appropriate data structure for such a task. [3 marks] ii. Provide the corresponding algorithm for solving such a problem based on the data structure you chose above. You can represent each step diagrammatically. [5 marks


Using java, define a class student with the following specification Private members of class student: admno integer sname string eng, math, science of type float total of type float ctotal() //a function to calculate eng + math + science with float return type. Public member function of class student: Takedata() //Function to accept values for admno, sname, eng, science and invoke ctotal() to calculate total. Showdata() //Function to display all the data members on the screen.


Write a java program using class called Rectangle and an object called rect. This class should have four members: two data members of type int with private access and two member functions with public access: set_values() and area().Set_values() to initialize the values of rectangle and area() to return the area of rectangle. Then finally write a main function to implement the above class


 Explain your own example of how you can use Java Math and String capabilities to find out something about a textual String object.

Write a java program using class called Rectangle and an object called rect. This class should have four members: two data members of type int with private access and two member functions with public access: set_values() and area().Set_values() to initialize the values of rectangle and area() to return the area of rectangle. Then finally write a main function to implement the above class. 


. develop a java application that uses a class called person which has 2 functions: getdata() and putdata(). The getdata() prompts the user to enter his or her first name, last name and age, the putdata() displays on the screen the user first name last, name and age. 


LATEST TUTORIALS
APPROVED BY CLIENTS