|
-
java code problem
Hello!
I try to write a program car registration. I have two class:
1-class Car
which has (model,color,motorPower). 2-class CarTable which has an array whit 50
place(we can put the cars and print out them)
class Car{
private String model;
private String color;
private double motorPower;
public Car(String iModel, String iColor, double iMotorPower){
.......
}//methodes
public String getModel(){
public String getColor(){
public double getPower(){
* public void setColor(String ){
* public String getCar(int n){
------------------------------------------------------
class CarTable{}
private String[]carVector;
private int nbr;
public CarTable (){
carVector= new String[50];
nbr=0;{
*public .....addCar(“ model”,”color”,”power”){
---------------------------------------------------------------------------------
The test program must be like this;
Public static void main(......)
Car b1 = new Car("Benz","blue",190);
Car b2;
CarTable myTable= new CarTable();
*b2 = myTable.getCar(1);
*myTable.addCar(new Car("Volvo","red",120));
*b2.setColor("green");
----------------------------------------------------------
MY PROBLEM is the sentences which have stars(*)
How can I complate class CarTable whit addCar() methode and
Class Car whit getCar() and setColor()
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks