GTU OOP Program - 7

7). Assume a vehicle plate number consists of three uppercase letters followed by four digits. Write a program to generate a plate number.

class Program_07 {
    public static void main(String[] args) {

        int letter1 = 65 + (int) (Math.random() * (90 - 65));
        int letter2 = 65 + (int) (Math.random() * (90 - 65));
        int letter3 = 65 + (int) (Math.random() * (90 - 65));

        // Generating four random numbers

        int num1 = (int) (Math.random() * 10);
        int num2 = (int) (Math.random() * 10);
        int num3 = (int) (Math.random() * 10);
        int num4 = (int) (Math.random() * 10);

        // Display number
        System.out.print("" + (char) (letter1) + ((char) (letter2)) + ((char) (letter3)) + num1 + num2 + num3 + num4);
    }
}

Output
cse gtu, gtu study material for computer engineering students gujarat
technological university oop lab manual solution

gtu oop lab manual,

oop GTU Practical,

oop Programs,

Object oriented Programming,

Gtu study material 3140705,

OOP 3140705,

oop practical list,

Java Programming,

gtu oop practical,

oop lab solution gtu

Comments

YouTube

Popular posts from this blog

GTU OOP Program - 18

GTU OS Program - 7

GTU OS Program - 3