Results 1 to 3 of 3
  1. #1
    thomachan21 is offline Member
    Join Date
    Nov 2012
    Posts
    11
    Rep Power
    0

    Default Needs to be compressed in to simpler code.

    Hi guys me and my teacher for computer science came up with this code together, to introduce how to make car models, and lisence plates. But unfortunantly our students does not understand how it is, and we tried to make it as simple as we could.

    If its possible, do you guys think you can dumb this down a little? Because we have a bunch of 1st years in Computer Science AP, and we tried the best we can do but it isnt working.

    whatever you guys can do to try and shrink it, but still make it able to recieve the programming that works.

    Looking forward to ur replies ^_^



    Java Code:
    import java.util.*; 
    public class CarRental
    {
            public static void main(String[] args) 
            {
                String mf;
                String model;
                String[] Manufacturer = {"Honda", "Toyota", "Volvo", "Lexus", "Hyundai","Mazda", "Ford", "Volkswagen",  "Audi",
                "Mitsubishi", "Land Rover", "Suzuki", "Nissan", "Subaru", "BMW", "KIA", "GM"};
                
                Scanner input = new Scanner(System.in); 
                System.out.println("Welcome to Ryans Honestly Used Car Lot!");
                System.out.println("Please enter your Car Manafacturer to see if we have it :");
                mf=input.nextLine();
                
                System.out.println("Wise choice there. Now please enter your Car Model:");
                model=input.nextLine();
                System.out.println("Model = " + model);
                
                String LPC;
                String RID = null;
                String LicensePlateCharacters = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
                String[] LicensePlateNumbers = {"1234567890"};
                System.out.println("Please enter your desired liscence plate, an example would be CPR 607:");
                LPC =input.nextLine();
                
                char[] License = LPC.toCharArray();
                int number = 0;
                int sum = 0;
                for(int x =0; x<3;x++)
                {
                    number+=(int)License[x];
                    System.out.print(number + " ");
            
                }
                sum = number;
                int si = sum+Integer.valueOf(LPC.substring(4));
                int x = si % 26;
                char alphaCode = (char)((int)'a'+x);
                alphaCode=String.valueOf(alphaCode).toUpperCase().charAt(0);
                
                System.out.println(number);
                System.out.println("Your License Plate Should Be: " + LPC + " = " + alphaCode + si);
                
                System.out.println("Your rental ID From Us Is: " + alphaCode + si);
                System.out.println("");
                System.out.println("Test Values:");
                System.out.println(License);
                System.out.println(si);
                System.out.println(alphaCode);
                System.out.println("");
                System.out.println("");
                
                System.out.println("Heres Your Receipt:");
                System.out.println("");
                System.out.println("The Make = " + mf);
                System.out.println("Your Model = " + model);
                System.out.println("Your License Plate is: " + LPC + " = " + alphaCode + si);
                
                System.out.println("Your rental ID From Us Is: " + alphaCode + si);
                System.out.println("Thank you for using Ryans Honestly Used Car Lot, Remember! If it aint Ryans, It aint nothing!");
                
            } 
       }

  2. #2
    Darkzombies is offline Senior Member
    Join Date
    Nov 2012
    Posts
    105
    Rep Power
    0

    Default Re: Needs to be compressed in to simpler code.


  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Needs to be compressed in to simpler code.

    I would question why your teacher can't explain this stuff if they also helped write it.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Transfer Compressed Array from RS232 port to USB
    By RacingSalmander in forum New To Java
    Replies: 1
    Last Post: 07-29-2012, 10:08 AM
  2. Replies: 0
    Last Post: 08-07-2011, 09:32 PM
  3. Compressed Image in j2me
    By Ashish_jain in forum New To Java
    Replies: 7
    Last Post: 07-04-2011, 03:50 PM
  4. Create GZIP compressed data using DeflaterInputStream?
    By johann_p in forum Advanced Java
    Replies: 15
    Last Post: 05-17-2011, 12:56 PM
  5. Help I need to make this code simpler ASAP!!
    By Quizzle23 in forum New To Java
    Replies: 5
    Last Post: 03-10-2011, 03:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •