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

2. Fraction/Mixed Fraction

by CodeChum Admin

 

Given the class Fraction in the code editor. Fill in the operations and display for the class Fraction. For plus and minus, think cross multiplication. times is straightforward, while divide has to do with reciprocals. toString should return the fraction in string format ("nume/deno" - as a String) but if denominator is 1, then the string should just contain the numerator.


More info here, Important!

https://pastebin.com/VRkEAe6g


2. Rectangle

by CodeChum Admin


A rectangle can be formed given two points, the top left point and the bottom right point. Assuming that the top left corner of the console is point (0,0), the bottom right corner of the console is point (MAX, MAX) and given two points (all "x" and "y" coordinates are positive), you should be able to draw the rectangle in the correct location, determine if it is a square or a rectangle, and compute for its area, perimeter and center point.


More details here, Important!

pastebin.com/8NDksx9M


1. Air Conditioning Unit

by CodeChum Admin

Construct a class to represent an air conditioning (AC) unit containing the following attributes:

  • brand - name of manufacturers like Samsung, LG, Carrier, etc.
  • type - whether it is an inverter type or not
  • power - represents the status of the AC unit whether it is turned on or not
  • thermostat - levels go from 1 to 10
  • temperature - levels go from 16 to 30 (in .5 intervals)
  • It should have two constructors - one default and another that is overloaded
  • default constructor
  • sets all the numerical values to the least value as described above
  • sets power to off, and type to inverter
  • sets brand to "AC Brand"
  • prints "Default Constructor"
  • overloaded constructor
  • accepts brand and type as arguments
  • everything else is set to the same values as in the default constructor
  • prints "Overloaded Constructor"


More details here, Important!

https://pastebin.com/yx0z0Tfr


import java.util.*;



class App {



public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.println("Enter a String: ");

String string = in.nextLine().toLowerCase();

System.out.print("Enter character to find: ");

String characterFind = in.nextLine().toLowerCase();

int index = string.indexOf(characterFind);

System.out.print("Index Position: ");

while (index >= 0) {

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

index = string.indexOf(characterFind, index + 1);

}

in.close();

}

}

Do this coding without using characterFind


Write a program in java.io package to take a String as input then display first word all capital letters, second word all small letters, third word all capital letters and so on.

Example:

Enter a String

Asia is the largest continent

ASIA is THE largest CONTINENT

Don't use array and split function


import java.util.*;



class App {



public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.println("Enter a String: ");

String words[] = in.nextLine().toLowerCase().split(" ");

for (int i = 0; i < words.length; i++) {

if (i % 2 == 0) {

System.out.print(words[i].toUpperCase() + " ");

} else {

System.out.print(words[i].toLowerCase() + " ");

}

}



in.close();

}

}

Do this programming without using array and split


Write a program to take a name as input then display the signature as the first letter of each word with dot.

Enter a String

Hubert Blaine Wolfeschlegelsteinhausenbergerdorff Sr

H.B.W.S.

Don't use array and split function


import java.util.*;



class App {



public static void main(String[] args) {

Scanner in = new Scanner(System.in);

System.out.println("Enter a String: ");

String words[] = in.nextLine().split(" ");

for (int i = 0; i < words.length; i++) {

System.out.print(words[i].toUpperCase().charAt(0) + ".");

}



in.close();

}

}

Do this coding without using array and split


import java.util.*;



class App {



public static void main(String[] args) {

Scanner in = new Scanner(System.in);



String names[] = new String[15];

double salaries[] = new double[15];

double salariesTotal = 0;



for (int i = 0; i < names.length; i++) {

System.out.print("Enter employee name " + (i + 1) + ": ");

names[i] = in.nextLine();

System.out.print("Enter employee salary " + (i + 1) + ": ");

salaries[i] = in.nextDouble();

salariesTotal += salaries[i];

in.nextLine();

}

System.out.println();

for (int i = 0; i < names.length; i++) {

System.out.println("Enter employee name: " + names[i]);

System.out.println("Enter employee salary: " + salaries[i]);

}

double averageSalary = salariesTotal / 15.0;

System.out.printf("The average salary employees: %.2f\n", averageSalary);



in.close();

}

}

Do this coding without using array and printf


Write a program to take a String name as input then display the signature using substring().

Example:

Enter a String

Chandra Bahadur Dangi Ailen Coq

C. Bahadur D. Ailen C.

Don't use Array & Split


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS