Java
Declare an integer variable cardsInHand and initialize it to 13.
LANGUAGE: JAVA CHALLENGE: Declare an integer variable cardsInHand and initialize it to 13.
Read MoreA location in memory used for storing data and given a name in a computer program is called a ______ because the data in the location can be changed.
LANGUAGE: JAVA CHALLENGE: A location in memory used for storing data and given a name in a computer program is called a ______ because the data in the location can be changed.
Read MoreFour 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 .
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 MoreWrite an expression that computes the difference of the variables endingTime and startingTime.
LANGUAGE: JAVA CHALLENGE: Write an expression that computes the difference of the variables endingTime and startingTime.
Read MoreYou 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.
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 MoreWrite an expression that computes the sum of two double variables total1 and total2, which have been already declared and assigned values.
LANGUAGE: JAVA CHALLENGE: Write an expression that computes the sum of two double variables total1 and total2, which have been already declared and assigned values.
Read MoreWrite an expression that computes the difference of two double variables salesSummer and salesSpring, which have been already declared and assigned values.
LANGUAGE: JAVA CHALLENGE: Write an expression that computes the difference of two double variables salesSummer and salesSpring, which have been already declared and assigned values.
Read MoreYou 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.
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 MoreYou 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.
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 MoreAssume that an int variable x that has already been declared, and initialized to a non-negative value.
LANGUAGE: JAVA CHALLENGE: Assume that an int variable x that has already been declared, and initialized to a non-negative value. Write an expression whose value is the last (rightmost) digit of x.
Read MoreAssume 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.
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 MoreAssume 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”.
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