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 an if-else statement that outputs the discount

The communication company offers a discount to customer who is taking at least 12-

month plan. The discount arrangement is as below: Business customer:

12/18 months 15% discount

24 months 25% discount

Non-Business customer

12/18 months 10% discount

24 months 15% discount

The variables customerType is of type char, period is of type int and discount is of


What does the following fragment display? (


) class MyClass

{

public static void main(String[] args) {

boolean b = true; int i = 2;

do

{

i++;

b = !b; } while (b);

System.out.println(i); }

}



Consider the following program written in Java and answer the question:

1. import java.util.*;

2. class Arraylist

3. {

4. public static void main(String args[])

5. {

6. ArrayList obj = new ArrayList();

7. obj.add("B");

8. obj.add("C");

9. obj.add("C");

10. obj.add("D");

11. obj.remove(2);

12. System.out.println(obj.get(1));

13. }

14. }

What would be the output of the statement when the program is executed? 


There are different kinds of numbers, but among them all, the most commonly used numbers in our daily lives are those positive ones. So, I only want you to count all the positive numbers from the 4 outputted values and print out the result.





Go and search for the positive ones among these four!



Input



A line containing four numbers (may contain decimal places) separated by a space.



2·-4·3.6·1


Output



A line containing an integer.



3

Where's the Biggest One?



by CodeChum Admin




We've already tried comparing 3 numbers to see the largest among all, so let's try a more complicated mission where we locate the position of the largest among 5 numbers. There are only 4 possible cases for this mission:




- if the largest digit is the first digit, print "Leftmost"




- if the largest digit is the third digit, print "Middle"




- if the largest digit is the last digit, print "Rightmost"




- if none of the above is correct, print "Unknown"







Now, show me how far you've understood your lessons!




Input




A line containing a five-digit integer.




1·4·6·3·2



Output




A line containing a string.




Middle

Java practical 1

It has been realized that hackers have started hacking and changing the account detains of some banks, to stop this practice, you have been tasked to create a class called Abaaneke, your class should contain three private variables (deposit, oldBalance, newBalace) all of type float and a variable of type String (name of the account holder)

Your class should also have a method that takes three arguments – name of account holder, amount deposited and old balance. The method should add the deposit to the oldBalance and call it new balance.

Using the right setters and getters, initialize the private variables and call the method to display the following

a. Account holders name

b. Amount deposited

c. Old balance

d. And new balance


how to use the arraylist to record the module details in student class?


4.The system verify the username and password. If wrong username,

please show the error message: Wrong username, please check and the re-enter your username. If wrong password,

please show the error message: Wrong password, please check and re-enter your password.

 

Display message to ask the user input

User name and password validation

Display the error message.

use of loop so user could re-enter the username/password when wrong input

 

If successful login, display the summary of the student

 

Correct format

Full set of details included as shown in the example

display of modules details

calculation of average mark, average attendance, grade conversion and correct display of remark message


3.

1 student who passes all modules exam and attendance,

1 student who passes all modules exam but fails some attendance,

1 student who fails some module exam but pass all modules attendance,

1 student who fails some modules in both exam and attendance

 

use array to record the 4 student profiles


2.

In the main , ask the user for the inputs: student ID, student name, password, study mode, the name of programme the student has registered, the current level of the programme, number of modules they have enrolled in the current term, the module codes and names, attendance of each module and exam mark of each module for each student profile. 

 

Display message to ask user inputs

use of Scanner for all inputs: 


LATEST TUTORIALS
APPROVED BY CLIENTS