Four integer variables , pos1, pos2, pos3, pos4 have been declared and initialized . Write the code necessary to “left rotate” their values : for each variable to get the value of the successive variable , with pos4 getting pos1’s value .

java

LANGUAGE: JAVA CHALLENGE: Four integer variables , pos1, pos2, pos3, pos4 have been declared and initialized . Write the code necessary to “left rotate” their values : for each variable to get the value of the successive variable , with pos4 getting pos1’s value .

Read More

You are given two variables , already declared and assigned values , one of type double , named price, containing the price of an order, and the other of type int , named totalNumber, containing the number of orders. Write an expression that calculates the total price for all orders.

java

LANGUAGE: JAVA CHALLENGE: You are given two variables , already declared and assigned values , one of type double , named price, containing the price of an order, and the other of type int , named totalNumber, containing the number of orders. Write an expression that calculates the total price for all orders.

Read More

You are given two double variables , already declared and assigned values , named totalWeight, containing the weight of a shipment, and weightOfBox, containing the weight of the box in which a product is shipped. Write an expression that calculates the net weight of the product.

java

LANGUAGE: JAVA CHALLENGE: You are given two double variables , already declared and assigned values , named totalWeight, containing the weight of a shipment, and weightOfBox, containing the weight of the box in which a product is shipped. Write an expression that calculates the net weight of the product.

Read More

You are given two variables , already declared and assigned values , one of type double , named totalWeight, containing the weight of a shipment, and the other of type int, named quantity, containing the number of items in the shipment. Write an expression that calculates the weight of one item.

java

LANGUAGE: JAVA CHALLENGE: You are given two variables , already declared and assigned values , one of type double , named totalWeight, containing the weight of a shipment, and the other of type int, named quantity, containing the number of items in the shipment. Write an expression that calculates the weight of one item.

Read More

Assume that price is an integer variable whose value is the price (in US currency) in cents of an item. Assuming the item is paid for with a minimum amount of change and just single dollars, write anexpression for the amount of change (in cents) that would have to be paid.

java

LANGUAGE: JAVA CHALLENGE: Assume that price is an integer variable whose value is the price (in US currency) in cents of an item. Assuming the item is paid for with a minimum amount of change and just single dollars, write anexpression for the amount of change (in cents) that would have to be paid.

Read More

Assume that price is an integer variable whose value is the price (in US currency) in cents of an item. Write a statement that prints the value of price in the form “X dollars and Y cents” on a line by itself. So, if the value of price was 4321, your code would print “43 dollars and 21 cents”. If the value was 501 it would print “5 dollars and 1 cents”. If the value was 99 your code would print “0 dollars and 99 cents”.

java

LANGUAGE: JAVA CHALLENGE: Assume that price is an integer variable whose value is the price (in US currency) in cents of an item. Write a statement that prints the value of price in the form “X dollars and Y cents” on a line by itself. So, if the value of price was 4321, your code…

Read More