Wednesday, January 29, 2014
Section 3.1: Numbers - Integer Operators
40331: Given the variables costOfBusRental and maxBusRiders, write an expression corresponding to the cost per rider (assuming the bus is full).
costOfBusRental \ maxBusRiders
41001: 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 an expression for the number of single dollars, write an expression for the number of single dollars that would have to be paid.
price \ 100
40332: Write an expression that computes the remainder of the variable principal when divided by the variable divisor. (Assume both are type int.)
principal Mod divisor
41002: 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 an expression for the amount of change (in cents) that would have the be paid.
price Mod 100
41100: Assume that an int variable x has already been delared. Write an expression whose value is the last (rightmost) digit of x.
x Mod 10
41023: 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 "S dollars and Y cents". So, if the value of price was 4321,k you 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".
MessageBox.Show((price \ 100) & " dollars and " & (price Mod 100) & " cents")
Section 3.1: Numbers - Arithmetic Operators
40905: Assume an int variable x has already been declared. Write an expression whose value is 1 more than x.
x + 1
40044: Write an expression that computes the sum of two double variables total1 and total2 which have been already declared and assigned values.
total1 + total2
40326: Write an expression that computes the sum of the two variables verbalScore and mathScore (already declared and assigned values).
verbalScore + mathScore
40327: Given the variables taxablePurchases and taxFreePurchases (already declared and assigned values), write an expression corresponding to the total amount purchased.
taxablePurchases + taxFreePurchases
40328: Write an expression that computes the difference of the variables endingTime and startingTime.
endingTime - startingTime
40329: Given the variables fullAdmissionPrice and discountAmount (already declared and assigned values), write an expression corresponding to the price of a discount admission. (The variable discountAmount holds the actual amount discounted, not a percentage.)
fullAdmissionPrice - discountAmount
40330: Given the variable pricePerCase, write an expression corresponding to the price of a dozen cases.
pricePerCase * 12
41014: A wall has been built with two pieces of sheetrock, a smaller one and a larger one. The length of the smaller one is stored in the variable small. Siumilarly, the length of the larger one is stored int he variable large. Write a single expression whose value is the length of this wall.
small + large
40045: Write an expression that computes the difference of two double variables salesSummer and salesSpring, which have been already declared and assigned values.
salesSummer - salesSpring
40046: 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.
totalWeight - weightOfBox
40047: 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.
totalWeight . quantity
40048: 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.
price * totalNumber
Section 3.1: Numbers - Literals
40038: Write a floating point literal corresponding to the value zero.
0.00
40039: Write a literal corresponding to the floating point value one-and-a-half.
1.5
40040: Write a literal corresponding to the value of the first 6 digits of PI ("three point one four one five nine").
3.14159
Subscribe to:
Posts (Atom)