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

Which of the following methods will compile without error?

public int add(List<? extends Number> list) {
int sum = 0;
for (Integer i : list) sum += i;
return sum;
}

public int add(List<? super Integer> list) {
int sum = 0;
for (Integer i : list) sum += i;
return sum;
}

public int add(List<? extends Integer> list) {
int sum = 0;
for (Integer i : list) sum += i;
return sum;
}

public int add(List<?> list) {
int sum = 0;
for (Integer i : list) sum += i;
return sum;
}
What argument do we send to the Scanner constructor to read from the java console?
Given two linked lists L, M that contain integer keys in sorted order, provide the pseudo code of a function to create a new list that contains L ∩ M in sorted order. Your function should traverse the two lists only once
Modify the sample programs below to include the following.
1. Gas should increase speed to a maximum speed and no more. Adjust the rate of speed increase and decrease as you see fit.
2. Add a break command and it should slow the vehicle down at constant rate (i.e. Not just go to 0).
3. When turning left or right, right is positive and left is negative. Starting directions should be North (0/360). A left turn at start would set your direction to 355 (if you use 5 degree increments). A right turn at start would set your direction to 5 (if you use 5 degree increments).
4. Add the ability to go up and down and display the altitude. Use current_loc.grid_z for the altitude.
5. Add a command to stop the simulation.

6. Extra Credit – save and restore configuration and simulation information in a file.
Your assignment for today is to use the information below to create a self-portrait using
// a variety of shapes. Here is a chance for you to show your creativity and spatial sense.
// The hardest part will be figuring out the coordinates of where to put things.
3) Write a test class in which you create a Student instance and then add to it some Receivable objects. Use the following data (left figure) and produce output as in the following figure (right).
Test Data:

Student: { name=Khalid Hussein, id=1045}

Type Description Semester Other data
Fee Admission fees Fall2013 creditHours=0; rate=0
Books Textbooks Fall2013 numberOfBooks=5
Fee Tuition fees Fall2013 creditHours=15; rate=600
Books Textbooks Spring2014 numberOfBooks=6
Service Swimming pool - Cost=200
Service Buss service - Cost=1000
Output:

Student:Khalid Hussein
Admission fees Fall 2013 200.00
Text Books Fall 2013 250.00
Tuition fees Fall 2013 9000.00
Books Spring 2014 300.00
Swimming Pool 180.00
Buss service 900.00
Received Total = 10830.0
2) For the Student class implement the parameterized constructor, getters for the shown fields and the method addReceivable() that adds the Receivable reference to the receivables list.
1) Write Java code for the Receivable interface and all the classes given in the class diagram. Implement the shown parameterized constructors. Also provide getters for all the shown fields (no setters are required). For a Service, the receivable amount is 0. 9 times the cost. For a Book: the receivable amount is 50 times the number of books. For Fees: if the creditHours is 0 then the amount is rate, otherwise, the amount is creditHours times the rate per hour (rate).
Give a definition of the following:

- Class method
- Instance method
- Class variable
- Instance variable
I created an object called 'saving's and I want to use it to combine & display information I have in 3 different toString() methods that are also in 3 different classes. How do I do this? I have tried putting super.toString(); at the end of each toString method and also extended the classes, but it will only print out one of the toString methods when I either do savings.toString(); or System.out.println(savings);
LATEST TUTORIALS
APPROVED BY CLIENTS