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 the output and if there is an error correct the error first then write the outp:

 

1.for(int i=-3; i<19; i=i+3)

{

 out.print(i + " ");

}

 

2.for(int j=17; j>-2; j=j-2)

{

 out.print(j + " ");

}

 

3.for(int x=20, x<50, x=x+3)

{

 out.print(x + " ");

}

  

4.for(m=37; m>0; m=m-4)

{

 out.print(m + " ");

}

 

5.int total=0;

for(int s=1; s<19; s++)

{

 total=total+s;

}

out.println(total);



6.int x=-2;

while(x<9)

{

 x++;

  System.out.print(x + " ");

}

 

7.int m=1, total=0;

while(m<9){

 total=total+m;

 m++;

}

System.out.print(total );

 

8.int k=5;

String s="";

while(k>0){

 s=k+" "+s;

 k--;

}

System.out.print(s);

  

9.int b=3;

String list="";

while(b<10) {

 b=b+2;

 if(b%2==1)

  list=b+" "+list;

}

System.out.print(list);


10.int num = 15, MAX = 20;

do 

num = num + 1; 

System.out.println (num); 

} while (num <= MAX);


11.int num = 15, MAX = 20; 

do 

{

num = num + 1;

if (num*2 > MAX+num)

System.out.println (num);

}

while (num <= MAX);


Write an application that counts by three from 3 through 300 inclusive, and that starts a new line after every multiple of 30 (30, 60, 90, and so on).

develop a java console application that either overhaul or automate it.

Implement the following java concept in your solution and highlight in your documentation or code where you did it:

1. Class and Object

2. File and Stream

3. Exception Handling


Martin your friend has declared a class called Employee with the following members; Employee


ID, Employee Name, Basic Salary, Allowance, and Net Salary.


a) Write a code for a member function called get_input that will be used for data input.


(3 Marks)


b) Write a code for a member function called Calculate that will be used to calculate net


salary as the sum of basic salary and allowances.


(2 Marks)


c) Write a code for the default constructor that will assign values to the variables in the


Employee class.


(3 Marks)


d) Write a code for the default constructor.


(3 Marks)


e) Write a complete program that captures and includes all the details in (a-d) above.


Run the code and show your output.


Martin your friend has declared a class called Employee with the following members; Employee ID, Employee Name, Basic Salary, Allowance, and Net Salary. a) Write a code for a member function called get_input that will be used for data input. (3 Marks) b) Write a code for a member function called Calculate that will be used to calculate net salary as the sum of basic salary and allowances. (2 Marks) c) Write a code for the default constructor that will assign values to the variables in the Employee class. (3 Marks) d) Write a code for the default constructor. (3 Marks) e) Write a complete program that captures and includes all the details in (a-d) above. Run the code and show your output. 


Write a Java program that creates an Array of string values and displays the duplicate values.


On the form create two combo boxes, one for the country selection and another to select a town. Also, add two radio buttons for the user to select to display either a phone or postal code.


You are also required to create a menu system which will allow the user to exit the application under the file menu. Under the tools menu allow the form submission and option to display the average yearly petrol price report. The layout of the form is left to your discretion. Marks will be allocated to the presentation and effectiveness of the layout, but the following layout is displayed for your convenience.


The application must allow a user to select between two countries, namely South Africa and the United Kingdom. When a particular country is selected, present the available towns in the town combo box.



Given the number of people attending a pizza party, output the number of needed pizzas and total cost. For the calculation, assume that people eat 2 slices on average and each pizza has 12 slices and costs $14.95.

Output each floating-point value with two digits after the decimal point, which can be achieved as follows:

System.out.printf("Cost: $%.2f\n", cost);

Ex: If the input is:

4

the output is:

Pizzas: 1
Cost: $14.95

Hint: Use the ceil() method to round up the number of pizzas so that enough pizzas are ordered.


create hangman using ArrayList


Given the number of people attending a pizza party, output the number of needed pizzas and total cost. For the calculation, assume that people eat 2 slices on average and each pizza has 12 slices and costs $14.95.

Output each floating-point value with two digits after the decimal point, which can be achieved as follows:

System.out.printf("Cost: $%.2f\n", cost)


LATEST TUTORIALS
APPROVED BY CLIENTS