Machine Problem

Create a class called Car. The Car class has the following fields:

1. Color

2. Model

3. Manufacturer

Instantiate 3 Car objects and display all their properties. Modify their defined properties and display their new properties.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Program Listing

/*
 *   Cars_Model.java
 *   Prof. Jake R. Pomperada, MAED-IT, MIT
 *   www.jakerpomperada.blogspot.com and  www.jakerpomperada.com
 *   jakerpomperada@gmail.com
 *   Bacolod City, Negros Occidental Philippines
 *   
 * Machine Problem
 * 
 * Create a class called Car. The Car class has the following fields:
1. Color
2. Model
3. Manufacturer

Instantiate 3 Car objects and display all their properties.
Modify their defined properties and display their new properties.

 */

 class Cars_Model {

        public static void main(String[] args) {   
            
            System.out.println("\n");
            System.out.println("\tCar Objects in Java");
            System.out.println("\n");
            
            Car car1 = new Car();     
            car1.color = "Red";     
            car1.model = "CRV";  
            car1.manufacturer = "Honda";
            car1.getCarInfo();    
 
            Car car2 = new Car();     
            car2.color = "Blue";     
            car2.model = "Vios";   
            car2.manufacturer = "Toyota";
            car2.getCarInfo();   

            Car car3 = new Car();     
            car3.color = "White";     
            car3.model = "Accent";     
            car3.manufacturer = "Hyundai";
            car3.getCarInfo();   
            
            System.out.println("\n");
            System.out.println("\tEnd of Program");
            System.out.println("\n\n");
 }
}

 class Car{
     String color, model, manufacturer;
     
    
    void getCarInfo(){ 
        System.out.println("\t" + color + "  " + model + " " + manufacturer);
    }
 }

Leave a Reply

Your email address will not be published.