OOP-JAVA Practical 7
- Aim: Assume a vehicle plate number consists of three uppercase letters followed by four digits. Write a Program to generate a plate number.
- Code:
import java.util.*; public class practical7{ public static void main(String args[]){ Random r=new Random(); int i; System.out.print("Vehical plate number is "); for(i=0;i<7;i++){ if(i<3){ System.out.print((char)(r.nextInt(26)+65)); } else{ System.out.print(r.nextInt(10)); } } } }
- Output:
The OOP-JAVA Practical 7 exercise is a great way to apply programming skills to real-world scenarios, like generating vehicle plate numbers. By combining three uppercase letters with four digits, students can practice object-oriented programming concepts while creating something practical and relevant.
ReplyDeleteOf course, even with well-planned vehicles, unexpected issues like tyre punctures can occur. That’s why having access to a reliable puncture repair service is so valuable. Quick professional assistance ensures your vehicle stays safe and road-ready at all times.