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")
Subscribe to:
Post Comments (Atom)
That is the best blog for anyone who desires to seek out out about this topic. You realize so much its virtually hard to argue with you (not that I actually would want…HaHa). You positively put a new spin on a topic thats been written about for years. Great stuff, simply nice! online casino slots
ReplyDelete