Posts by Matthew Maennche
Calculate the average (as a double ) of the values contained in the integer variables num1, num2, num3 and assign that average to the double variable avg.
LANGUAGE: JAVA CHALLENGE: Calculate the average (as a double ) of the values contained in the integer variables num1, num2, num3 and assign that average to the double variable avg. Assume the variables num1, num2, and num3 have been declared and assigned values, and the variable avgdeclared.
Read MoreGiven two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced.
LANGUAGE: JAVA CHALLENGE: Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced.
Read MoreWrite an expression for the average number of tickets sold per school child.
LANGUAGE: JAVA CHALLENGE: Three classes of school children are selling tickets to the school play. The number of tickets sold by these classes, and the number of children in each of the classes have been read into these variables : tickets1, tickets2, tickets3 and class1, class2, class3. Write an expression for the average number of tickets sold per…
Read MoreWrite a single expression whose value is the total area of this room. DO NOT any method invocations.
LANGUAGE: JAVA CHALLENGE: Each of the walls of a room with square dimensions has been built with two pieces of sheetrock, a smaller one and a larger one. The length of all the smaller ones is the same and is stored in the variable small. Similarly, the length of all the larger ones is the same and is…
Read MoreWrite a single expression whose value is the total area of the two rooms.
LANGUAGE: JAVA CHALLENGE: The dimensions (width and length) of room1 have been read into two variables : width1 and length1. The dimensions of room2 have been read into two other variables : width2 and length2. Write a single expression whose value is the total area of the two rooms.
Read MoreWrite an expression that computes the integer average of the int variables exam1 and exam2 (both declared and assigned values).
LANGUAGE: JAVA CHALLENGE: Write an expression that computes the integer average of the int variables exam1 and exam2 (both declared and assigned values).
Read MoreWrite an expression that computes the average of the values 12 and 40.
LANGUAGE: JAVA CHALLENGE: Write an expression that computes the average of the values 12 and 40.
Read MoreWrite an expression that computes the remainder of the variable principal when divided by the variable divisor. (Assume both are type int.)
LANGUAGE: JAVA CHALLENGE: Write an expression that computes the remainder of the variable principal when divided by the variable divisor. (Assume both are type int.)
Read Morewrite an expression corresponding to the cost per rider (assuming the bus is full). (Do not worry about any fractional part of the expression — let integer arithmetic, with truncation, act here.)
LANGUAGE: JAVA CHALLENGE: Given the variables costOfBusRental and maxBusRiders of type int, write an expression corresponding to the cost per rider (assuming the bus is full). (Do not worry about any fractional part of the expression — let integer arithmetic, with truncation, act here.)
Read MoreGiven the variable pricePerCase, write an expression corresponding to the price of a dozen cases.
LANGUAGE: JAVA CHALLENGE: Given the variable pricePerCase, write an expression corresponding to the price of a dozen cases.
Read MoreGiven the variables fullAdmissionPrice and discountAmount (already declared and assigned values), write an expression corresponding to the price of a discount admission.
LANGUAGE: JAVA CHALLENGE: Given the variables fullAdmissionPrice and discountAmount (already declared and assigned values), write an expression corresponding to the price of a discount admission.
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 More