Java | JSP | JSF Answers

Questions answered by Experts: 3 611

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

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.
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++;

}
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.
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).
convert to ternary operator if(x<=2) y=2.5*x+3 else y=5*x+4
Write the complete java program called Temperature that includes a for loop structure,

prompting the user to enter 5 temperature values. The program should add up each

temperature entered within the loop and this is stored in a variable called total. Using a

system statement, output the total temperature value and the average temperature value.
Briefly (i.e., in no more than 2 sentences) describe the benefit(s) of using Hamcrest (i.e., "assertThat" and associated matchers) over "assertTrue", "assertFalse" and "assertEquals."
Give an example of a class and an example of an object. Describe what a class is, what an object is, and how they are related. Use your examples to illustrate the descriptions.
What value(s) will be output by the following Java code statements?

System.out.println( Math.pow( 3, 3 ) ); _________________

System.out.println( Math.sqrt( 25 ) ); _________________

System.out.println( Math.sqrt( 64 ) ); _________________
LATEST TUTORIALS
APPROVED BY CLIENTS