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

The following class Pizza has incomplete codes. Write setter and getter methods for all instance variable of the class, create a parameterized constructor of this class, use isLargePizza() method, and toString() method.


public class Pizza {

String name;
double diameter;

//constructor
void Pizza()
{
//Missing Lines
}

public String isLargePizza()
{
// missing lines
}

@Override
public String toString() {
// missing lines
return super.toString();
}


Hint: When the size of the pizza is greater than 20cm, then it must be considered as large pizza. The islargePizza() method must return boolean value indicating whether the pizza is large or not.
Also, correct the given code where necessary.
Explain what is meant by thesyntaxand thesemanticsof a programming language.GiveJava examples to illustrate the difference between asyntax errorand asemantics error.Use different examples than those found in the textbook.
Describe the for loop and compare with the for-each loop by describing the operation of each and
discussing how they differ from each other. You must include the role of enums in your description and
provide an example of a for loop and a for-each loop.
Create the java program called Product that prompts the user to enter names of hardware devices. The program includes a sentinel loop with a value of ### that stops the input from the user. Include a counter variable called inputnum inside the loop, that counts the number of hardware devices the user entered. Using a system statement inside the loop, display the names of hardware devices the user entered. Include a dialog box outside the loop that displays the counter variable value (number of hardware device names entered by the user
public class ForLoopTest
{
public static void main(String[] args)
{
for(int count = 2; count <= 10; count++)
{
System.out.println(count);
}

}
}

can you make it count backwards
public class ForLoopTest
{
public static void main(String[] args)
{
for(int count = 2; count <= 10; count++)
{
System.out.println(count);
}

}
}



can you make it count by 2's
Here is a while loop that counts from 1 to 5 that demonstrates the 3 steps of writing a loop. Can you change it to count from 2 to 10? Can you make it count by 2s? Can you make it count backwards?public class LoopTest1
{
public static void main(String[] args)
{
// 1. initialize the loop variable
int count = 1;

// 2. test the loop variable
while (count <= 5)
{
System.out.println(count);
// 3. change the loop variable
count++;
}
Problem
Write a program to implement basic heap operations. Your main function must display the following menu repeatedly:

1. Build a heap.
2. Print the heap.
3. Insert a node.
4. Delete the largest node.
5. Search the heap for a key.
6. Exit.

- Option 1 should use the user’s input data to build a heap.
- Option 2 prints the heap using the breadth-first traversal.
- Option 5 searches the heap for a key and prints the location of the key in the array.

Other Requirements
• Your code should include comments as specified in the course syllabus
a) Create a class named Sandwich. Data fields for this class include a String for the main ingredient (E.g. Tuna), a String for bread type (E.g. Wheat) and the third field for double data type to store the sandwich price (N$15.00). Include methods to get and set values for each of these fields. Save the class as Sandwich.java.
write a program to enter three numbers and a character find and print the sum of the numbers if the given character is s and product of the numbers if the given character is p the program displays a message invalid character if the user enters an alphabet other than s or p
LATEST TUTORIALS
APPROVED BY CLIENTS