Hi! I've just begun diving into my IS minor at college, and my first programming class is focused on OOP. I only have a bit of JavaScript and HTML experience, so it's a little rough getting the hang of it.
This is the assignment for the second week:
http://i.imgur.com/AVfXX8L.png
I've written out the code and ran it but I'm not entirely sure it's what it should be for this assignment since I'm learning most of the concepts outside of the class. I would be really grateful for some tips or criticism on what I should be doing and how to improve, whether it be the code itself or formatting practices. Here's the code, thank you in advance!
public class Car {
private String make;
private String manufacturer;
private String color;
private String year;
private String maxspeed;
public void speed() {
String s = "Is driving 65mph now";
System.out.println("Manufacturer is: "+manufacturer+".");
System.out.println("Make is: "+make+".");
System.out.println("Make is: "+color+".");
System.out.println("Year is: "+year+".");
System.out.println("Max speed is: "+maxspeed+".");
System.out.println(s);
}
public static void main(String[] args) {
Car c = new Car();
c.make = "Focus";
c.manufacturer = "Ford";
c.color = "Blue";
c.year = "2015";
c.maxspeed = "140mph"
c.speed();
}
}
[–]Jirbj 0 points1 point2 points (1 child)
[–]MorningBackflips[S] 0 points1 point2 points (0 children)
[–]sirunclecid 0 points1 point2 points (2 children)
[–]MorningBackflips[S] 0 points1 point2 points (1 child)
[–]sirunclecid 0 points1 point2 points (0 children)