COP2210 Lab 3
IMPORTANT: The goal is to work through it and get it running. If you are getting stuck ASK THE LAB ASSISTANT OR OTHER STUDENTS to help you. It is a good idea to work together in the lab. You will learn a lot this way. Note, I have left out some things for you to figure out and learn from. Important, if you get stuck ask questions this is how you learn. 1. Start Netbeans and under the File menu select New Project. This will open up a window that looks similar to the one illustrated below. Proceed by clicking on the Next button
2. Then you will see a new window as shown below. In the Project Name field type in COP2210_Lab3 and on the Create Main Class field type in the correct input so your Netbean Project Structure will look like this:
This is how your project should look like now. If it is not like this delete your files and folders and start over.
3. Add the new Java Package by third mouse clicking on Source Packages icon.
Then put vehicle for the package name. Notice that the package name is lowercase.
This is how your project should look like now
4. Add the Car.java file to your project. Look carefully where I am putting the file.
This is how your project should look like now
5. Set the project as the Main Project: Go to the Run Menu and then select Set Main Project then COP2210_Lab3. See figure below:
6. Add the file header to the Car.java and the Controller.java files: • Double click the Car.java file so it opens in the Nebeans’ text editor. • Add the code Header at the beginning of this file and enter your information into the header. • Double click the Controller.java file so it opens in the Nebeans’ text editor. • Add the code Header at the beginning of this file and enter your information into the header. • Remember if you do not do this you will get 40% off the assignment. File Header //============================================================================= // PROGRAMMER: Your name // PANTHER ID: Your panther ID // // CLASS: COP2210 // SECTION: Your class section: example U01 // SEMESTER: The current semester: example Fall 2018 // CLASSTIME: Your COP2210 course meeting time :example T/TH 9:00-10:15 am // // Project: Put what this project is: example Lab 5 or Project 1 // DUE: // // CERTIFICATION: I understand FIU’s academic policies, and I certify that this work is my // own and that none of it is the work of any other person. //=============================================================================
7. Write this code for the Car.java file that correspondence to the UML diagram below. Hint: Look at the Human.java code from the class notes. Important:
• The price of a car is a random integer number ranging from 25000 – 30000. Look at earlier class notes for hints on this. • The default constructor: public Car(), sets the Color to Black and the Number of Doors to 2
Important: This is the output from the displayInfo() method. You need to reversed engineer it. ----------------------------------- Car Info ----------------------------------- CarID: 1002 Factory: Michigan Number of Doors: 4 Color White Price: $23798 This is the output from the displayClassInfo() method. You need to reversed engineer it. ----------------------------------- Car Class Info ----------------------------------- vehicleCounter: 1004 CAR_FACTORY_ID: Michigan
8. Write this code for the Controller.java main method. You are to write the code for #1-#9. The instruction for the code are above the number sign. public static void main(String[] args) { // create Car instance named c1 using the default constructor Car c1 = new Car(); // create Car instance named c2 which is White and has 4 doors // #1 YOU WRITE THE CODE HERE // create Car instance named c3 which is Red and has 2 doors // #2 YOU WRITE THE CODE HERE // create Car instance named c4 which is Green and has 6 doors // #4 YOU WRITE THE CODE HERE // call the displayInfo method on c1 // #5 YOU WRITE THE CODE HERE
// call the displayInfo method on c2 // #6 YOU WRITE THE CODE HERE // call the displayInfo method on c3 // #7 YOU WRITE THE CODE HERE // call the displayInfo method on c4 // #8 YOU WRITE THE CODE HERE // call the displayCarInfo method on the class Car // #9 YOU WRITE THE CODE HERE }//end main()
9. Lab output should look like this. Note your prices will be different because the prices are random numbers ranging from $25000 - $30000 ----------------------------------- Car Info ----------------------------------- CarID: 1001 Factory: Michigan Number of Doors: 2 Color Black Price: $27092 ----------------------------------- Car Info ----------------------------------- CarID: 1002 Factory: Michigan Number of Doors: 4 Color White Price: $28180 ----------------------------------- Car Info ----------------------------------- CarID: 1003 Factory: Michigan Number of Doors: 2 Color Red Price: $28145 ----------------------------------- Car Info ----------------------------------- CarID: 1004 Factory: Michigan Number of Doors: 6 Color Green Price: $29408 ----------------------------------- Car Class Info ----------------------------------- vehicleCounter: 1004 CAR_FACTORY_ID: Michigan 10. If you do not finish during lab time please complete the assignment at home and upload your ENTIRE ZIPPED Netbeans project to canvas via Lab 3 upload link before the due time. DO NOT EMAIL ME YOUR ZIPPED FILE. You must upload it in canvas using the Lab3 link. Otherwise you will receive a zero for the assignment. Thank you J
Applied Sciences
Architecture and Design
Biology
Business & Finance
Chemistry
Computer Science
Geography
Geology
Education
Engineering
English
Environmental science
Spanish
Government
History
Human Resource Management
Information Systems
Law
Literature
Mathematics
Nursing
Physics
Political Science
Psychology
Reading
Science
Social Science
Home
Blog
Archive
Contact
google+twitterfacebook
Copyright © 2019 HomeworkMarket.com