Java | JSP | JSF Answers

Questions answered by Experts: 3 611

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

Define a class called Complex with instance variables real, imag and instance methods

setData(), display(), add(). Write a Java program to add two complex numbers.

The prototype of add method is: public Complex add(Complex, Complex).


Create a GUI application “Address Book” which can be used to store and search the information of different people. The information can be: name, phone no, email, street address etc. Your project should have the following features:

1. A GUI where user can input the information of a particular people

2. A file where all information are stored. (You will have to append new info to the file. Otherwise the previous information will be lost ,you have to use file reader and writer method)

3. A GUI in which the user will be able to see all the information, sorted by name. The information must come from the file where you stored user information. (Hint: use JTextArea to show all user info)

4. A GUI where the user will be able to search a person using his name or phone no. The search result should show the info of all the matched person

5. A GUI where the user will be able to edit the information of a specific person. 


Exercise 1:

 

1.     //The max function the max between a and b, it returns a if a == //b

public double max(double a, double b);  

 

2.     //The mult function returns the result of a * b public double mult(double a, double b);

 

3.     //The exist in array function returns the index of the element //‘a’ if //‘a’ exist in array ‘arr’ otherwise returns ‘-1’ public int existsInArray(int [] arr, int a);

 

4.     //Are array equals method compares two arrays and returns true // if the elements of array ‘a’ are equal to elements of array

// ‘b’, element by element. If equals it returns 0, it returns -

// 1 if not

public int areArrayEquals(int [] a, int [] b); 

 

 

Devise four executable test cases for every method in the JUnit notation. See the attached handout for a refresher on the notation.  

 


Suppose that you are hired by a High-End “Gola Ganda” shop, this shop offers Gola Gandas of all shapes and sizes. They have basic gola gandas of three sizes: Small, Medium and Large. All have different prices  

A customer can add as many toppings on it as they want, the toppings could be more “Sauce”, Condensed Milk, Nutella, etc (more can be added). Every topping has a different cost, and the cost of each topping will be added on top of the cost of the size of gola ganda.  

For example, if a small gola ganda cost, 50 rupees, and a topping of condensed milk cost 10 rupees, and a topping of Nutella cost 20 rupees, and if a customer has ordered a small gola ganda with condensed milk and Nutella then the total cost will be 80 rupees (50 for small gola ganda, 10 for condensed milk, and 20 for Nutella).  

 


Write Java program which calculator your annual expenses


Let a class Person contains data members name and age. A constructor with two arguments

is used to assign name and age. Person is of two types a) Student and b) Teacher. class

Student contains data members i)course ii) Roll Number and iii)Marks and method

display() to display data related to student. Similarly, class Teacher contains data members

i) subject_assigned (May take this as a String) ii) contact_hour and method display () to

display data related to teacher. Implement this program using base class constructor in

derived class


A point in the x-y plane is represented by its x-coordinate and y-coordinate. Design a class, PointType in Java, that can store and process a point in the x-y plane.Every circle has a center and a radius. Given the radius, we can determine the circle’s area and circumference. Given the center, we can determine its position in the x-y plane. The center of a circle is a point in the x-y plane. Design a class, CircleType that can store the radius and center of the circle. Because the center is a point in the x-y plane and you designed the class to capture the properties of a point from PointType class. You must derive the class CircleType from the class PointType. You should be able to perform the usual operations on a circle, such as setting the radius, printing the radius, calculating and printing the area and circumference, and carrying out the usual operations on the center.


Identify a real-world scenario for the below task:


A task where the next one to work on is always the one that has been waiting the longest.

  1. For the above task, explain your choice of an appropriate data structure for such a task
  2. Provide the corresponding algorithm for solving such a problem based on the data structure you chose above. You can represent each step diagrammatically.

B. Identify a real-world scenario for the below task:

 5

 

  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]


C. As the lead system engineer at AIT, you have been given raw data for hundred (100) students who sat for an entrance exam and you have been asked to write the pseudocode to summarize the results. For each student grade, it is written a “P” for pass and “F” for fail.

 6

 

Use indentation and line numbers to highlight the flow of the program:

Your pseudocode should address the following:

i. Prompt the user to enter each result one after the other

ii. Provide a count of the results of each type

iii. Summarize the results indicating the number that passed or failed


LATEST TUTORIALS
APPROVED BY CLIENTS