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

Write a class Battery that models a rechargeable battery.

        Capacity: double

        String company;

·        having no parameter – for setting values to zero or null.

·        having two parameters for assigning values to both data members.

·        Overload the above constructor and use this keyword to set the values of data members

·        Provide getters and setters for data member(s).

·        The method public void drain (double amount) drains the capacity of the battery by the given amount.

·        The method public void charge () charges the battery to its original capacity.

·        A method toString to print object data.


1.     Inside main, create 3 objects.

a.     Set values of first object using constructor.

b.     Take data from user and set the values for the 2 objects and display values.

2.     Call all the above methods (drain, charge) and display updated values.


 Write Java code for implementing arrays that accepts user inputs and then displays them. Take different arrays like this: stringArray, integerArray, doubleArray.



(a)  Write Java code for implementing arrays that accepts user inputs and then displays them. Take different arrays like this: stringArray, integerArray, doubleArray.



1. Create a program that will convert the input dollar(s) into its equivalent peso. One dollar is approximately equal to 50.60 pesos. Then display The result.




Sample output:




The equivalent of $100 into is Php5,060.00

1. Create a program that will convert the input dollar(s) into its equivalent peso. One dollar is approximately equal to 50.60 pesos. Then display The result.

1. Create a program that will convert the input dollar(s) into its equivalent peso. One dollar is approximately equal to 50.60 pesos. Then display The result.



Sample output:



The equivalent of $100 into is Pho 5, 060.00

Using the above code add a method that takes in three arrays, one for student names, one for final test marks and a last one for assignment mark. The method should then calculate the students qualifying mark (a student needs 50 or more to qualify) using the following weights: 40% of the test and 60% of the assignment, finally print out whether the person qualified or not. [10]


1. Write a JavaScript function that takes a module name and code then displays their values.


2. Write a JavaScript function that takes two numbers and prints out the product.


3. Define a JavaScript object that has two properties: Module with a value of “Multimedia Fundamentals” and code with a value of “FMM200”.


4. Create a JavaScript object Course with the properties course_id, course_name and course_credit.


5. Create a JavaScript array with the module codes “ADF101”, “FMM200”,” ITE300”,”PRJ300”,”ADS200” and print out all these codes.


6. Write a JavaScript code to show the number of elements in the modules array.


7. Write a JavaScript code that adds the module code “CNF200” into the modules array.


8. Write a JavaScript code to get the last element in the modules array.



Write a complete program to create HotelRoom class and test class based on the class

diagram above, table below and the following requirements: HotelRoom Class is derived

from Rental and implements Comparable Interface.

The getRentalRate() method from the Rental class will be implemented in the HotelRoom

class to determine and return a room rental rate based on the room types. The room types

and its associated rental rate can be referred in Table 1.

The method toString() will return the information of HotelRoom object.

The HotelRoom class implements compareTo() method from the interface

java.langComparable to compare the room rental rate for two objects of HotelRoom.

Write a test program that creates two HotelRoom objects with any values of the rentalNum,

roomNo and roomTypes.

Display all the information of these two objects including the rental rate comparison result. 


Using this online IDE, perform the following.

1. Initialize four (4) variables based on the table below.

Data type Variable NameValue

String firstName Your first name.

String lastName Your last name.

char mi Your middle initial

int faveNumber Your favorite number

String faveCartChar Your favorite cartoon or anime character

2. Create statements that would print an output similar to the sample below. Use '+' to combine words and variable names. 


LATEST TUTORIALS
APPROVED BY CLIENTS