Skip to main content
ICT
Lesson A10 - The String Class
 
Main Previous Next
Title Page >  
Summary >  
Lesson A1 >  
Lesson A2 >  
Lesson A3 >  
Lesson A4 >  
Lesson A5 >  
Lesson A6 >  
Lesson A7 >  
Lesson A8 >  
Lesson A9 >  
Lesson A10 >  
Lesson A11 >  
Lesson A12 >  
Lesson A13 >  
Lesson A14 >  
Lesson A15 >  
Lesson A16 >  
Lesson A17 >  
Lesson A18 >  
Lesson A19 >  
Lesson A20 >  
Lesson A21 >  
Lesson A22 >  
Lesson AB23 >  
Lesson AB24 >  
Lesson AB25 >  
Lesson AB26 >  
Lesson AB27 >  
Lesson AB28 >  
Lesson AB29 >  
Lesson AB30 >  
Lesson AB31 >  
Lesson AB32 >  
Lesson AB33 >  
Vocabulary >  
 

LAB ASSIGNMENT A10.2 page 16 of 17

CarRental

Background:

When you rent a car from an agency, the key ring has several pieces of information: license plate, make and year of car, and usually a special code. This code could be used for some data processing within the company's computers. This lab will practice determining that special car rental code from the license plate.

Assignment:

  1. The following sequence of steps will be used to convert a license plate into a car rental code.

    1. A license plate consists of 3 letters followed by a 3 digit integer value.

    2. Type in the license plate information as 3 characters followed by a single integer value. For example, CPR 607.

    3. Add up the ASCII values of the 3 letters, 67 + 80 + 82 = 229.

    4. Add the sum of the letters to the single integer value. For example, 229 + 607 = 836.

    5. Take this sum (836) and determine the integer remainder after dividing by 26:
      836 % 26 = 4.

    6. Determine the 4th letter in the alphabet after the letter 'A': 4th letter after 'A' = E.

    7. Combine the letter and the sum, the car id number for license plate
      CPR 607 = E836.

  2. You may assume that all sample data will be in the format of 3 alphabet characters, then a space, followed by a 3 digit integer.

Instructions:

  1. Prompt the user for the make and model of the car. Use strings to create this part.

  2. Prompt the user for the license plate.

  3. Print the run output in this format.

    Make = Chevrolet
    Model = Suburban
    CPR 607 = E836

  4. Solve the following run outputs:

    RJK 492
    SPT 309

    The input values for the make and model strings are your choice.

 

Main Previous Next
Contact
 © ICT 2006, All Rights Reserved.