Hi guys, at the moment, im rushing to get my assignment done as the dateline is soon. Haven't had much time lately, so i'm in need of some help.
Im supposed to create a program that :
Has a Vehicle superclass, and a Taxi subclass.
1) Can accept new Taxi into an array
2) Can delete old records of Taxi from the array
3) Have to be able to retain the previous added data (which i think most likely im gonna do it by saving and reading the data from the array into a txt file of which im still wondering how)
4) Able to sort the records
5) Able to show the average price.
What i've done so far is this :
Just to test out if my 2dimensional array is working fine, but apparently i get an error when i compile.
Any help is appreciated. 6 3514
Hi guys, at the moment, im rushing to get my assignment done as the dateline is soon. Haven't had much time lately, so i'm in need of some help.
Im supposed to create a program that :
Has a Vehicle superclass, and a Taxi subclass.
1) Can accept new Taxi into an array
2) Can delete old records of Taxi from the array
3) Have to be able to retain the previous added data (which i think most likely im gonna do it by saving and reading the data from the array into a txt file of which im still wondering how)
4) Able to sort the records
5) Able to show the average price.
What i've done so far is this :
Just to test out if my 2dimensional array is working fine, but apparently i get an error when i compile.
Any help is appreciated.
1.)You did not specify that error that you got.
2.)You don't have to post all your code for this. Just the bits where you need specific help with.
3.)Did you write the Vehicle and Taxi classes correctly(You don't have to post them)?
1.)You did not specify that error that you got.
2.)You don't have to post all your code for this. Just the bits where you need specific help with.
3.)Did you write the Vehicle and Taxi classes correctly(You don't have to post them)?
Error that i got is : Vehicle2.java:3 2: illegal start of expression
private static void addATaxi(CarLis t theCarList) {
^
1 error.
Uh, in this one, i dont think vehicle and taxi classes are even used yet? im just testing out if the main menu + receive input for the addTaxi method is working properly...
Error that i got is : Vehicle2.java:3 2: illegal start of expression
private static void addATaxi(CarLis t theCarList) {
^
1 error.
Uh, in this one, i dont think vehicle and taxi classes are even used yet? im just testing out if the main menu + receive input for the addTaxi method is working properly...
You cannot test anything before you write the Vehicle and Taxi classes. Write those first. You will need to be creating instances of Taxis in the test class and you cannot do that before you write the Taxi class.
You cannot test anything before you write the Vehicle and Taxi classes. Write those first. You will need to be creating instances of Taxis in the test class and you cannot do that before you write the Taxi class.
hmm okay... uh im not very good at java so yea, correct me if anything's amiss.. -
-
public class Vehicle {
-
private String plateNum;
-
private String brandName;
-
private String modelType;
-
private double vehicleSpeed;
-
private double vehiclePrice;
-
-
public void setPlateNum(String plateNum) {
-
this.plateNum = plateNum;
-
}
-
-
public void setBrandName(String brandName) {
-
this.brandName = brandName;
-
}
-
-
public void setModelType(String modelType) {
-
this.modelType = modelType;
-
}
-
-
public void setVehicleSpeed(double vehicleSpeed) {
-
this.vehicleSpeed = vehicleSpeed;
-
}
-
-
public void setVehiclePrice(double vehiclePrice) {
-
vehiclePrice = vehiclePrice;
-
}
-
-
public String getPlateNum() {
-
return this.plateNum;
-
}
-
-
public String getBrandName() {
-
return this.brandName;
-
}
-
-
public String getModelType() {
-
return this.modelType;
-
}
-
-
public double getVehicleSpeed() {
-
return this.vehicleSpeed;
-
}
-
-
public double getVehiclePrice() {
-
return this.vehiclePrice;
-
}
-
}
-
-
-
public class Taxi extends Vehicle {
-
private String tRegNum;
-
private String tCompany;
-
-
public void setTRegNum(String tRegNum) {
-
this.tRegNum = tRegNum;
-
}
-
-
public void setTCompany(String tCompany) {
-
this.tCompany = tCompany;
-
}
-
-
public String getTRegNum() {
-
return this.tRegNum;
-
}
-
-
public String getTCompany() {
-
return this.tCompany;
-
}
-
}
-
sicarie 4,677
Recognized Expert Moderator Specialist
hmm okay... uh im not very good at java so yea, correct me if anything's amiss.. -
-
public class Vehicle {
-
private String plateNum;
-
private String brandName;
-
private String modelType;
-
private double vehicleSpeed;
-
private double vehiclePrice;
-
-
public void setPlateNum(String plateNum) {
-
this.plateNum = plateNum;
-
}
-
-
public void setBrandName(String brandName) {
-
this.brandName = brandName;
-
}
-
-
public void setModelType(String modelType) {
-
this.modelType = modelType;
-
}
-
-
public void setVehicleSpeed(double vehicleSpeed) {
-
this.vehicleSpeed = vehicleSpeed;
-
}
-
-
public void setVehiclePrice(double vehiclePrice) {
-
vehiclePrice = vehiclePrice;
-
}
-
-
public String getPlateNum() {
-
return this.plateNum;
-
}
-
-
public String getBrandName() {
-
return this.brandName;
-
}
-
-
public String getModelType() {
-
return this.modelType;
-
}
-
-
public double getVehicleSpeed() {
-
return this.vehicleSpeed;
-
}
-
-
public double getVehiclePrice() {
-
return this.vehiclePrice;
-
}
-
}
-
-
-
public class Taxi extends Vehicle {
-
private String tRegNum;
-
private String tCompany;
-
-
public void setTRegNum(String tRegNum) {
-
this.tRegNum = tRegNum;
-
}
-
-
public void setTCompany(String tCompany) {
-
this.tCompany = tCompany;
-
}
-
-
public String getTRegNum() {
-
return this.tRegNum;
-
}
-
-
public String getTCompany() {
-
return this.tCompany;
-
}
-
}
-
Other than a constructor by which to instantiate (create) your objects, I think you're on the right track.
hmm okay... uh im not very good at java so yea, correct me if anything's amiss.. -
-
public class Vehicle {
-
private String plateNum;
-
private String brandName;
-
private String modelType;
-
private double vehicleSpeed;
-
private double vehiclePrice;
-
-
public void setPlateNum(String plateNum) {
-
this.plateNum = plateNum;
-
}
-
-
public void setBrandName(String brandName) {
-
this.brandName = brandName;
-
}
-
-
public void setModelType(String modelType) {
-
this.modelType = modelType;
-
}
-
-
public void setVehicleSpeed(double vehicleSpeed) {
-
this.vehicleSpeed = vehicleSpeed;
-
}
-
-
public void setVehiclePrice(double vehiclePrice) {
-
vehiclePrice = vehiclePrice;
-
}
-
-
public String getPlateNum() {
-
return this.plateNum;
-
}
-
-
public String getBrandName() {
-
return this.brandName;
-
}
-
-
public String getModelType() {
-
return this.modelType;
-
}
-
-
public double getVehicleSpeed() {
-
return this.vehicleSpeed;
-
}
-
-
public double getVehiclePrice() {
-
return this.vehiclePrice;
-
}
-
}
-
-
-
public class Taxi extends Vehicle {
-
private String tRegNum;
-
private String tCompany;
-
-
public void setTRegNum(String tRegNum) {
-
this.tRegNum = tRegNum;
-
}
-
-
public void setTCompany(String tCompany) {
-
this.tCompany = tCompany;
-
}
-
-
public String getTRegNum() {
-
return this.tRegNum;
-
}
-
-
public String getTCompany() {
-
return this.tCompany;
-
}
-
}
-
1.)You don't have to post all your code.
2.)You need to put at least two constructors for each of these classes for creating the objects with. One should be the default (no-arg cnstructor and one should take the required arguments necessary to create meaningful objects with these classes)
3.)You need to be able to compare these objects with each other so you need to implement the Comparable interface and add the compareTo method.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: noname |
last post by:
Hello all, I use Access to keep track of approx. 80 vehicles.
I have a table of vehicles with specs.
I have another of service records linked to the vehicle table.
Works great! I can expand each vehicle to see what service I have performed
on just that vehicle.
I also have tables for billing categories, employees and departments.
So far so good.
Now I need to make it to where I can enter the fuel used by each vehicle
when someone fills...
|
by: Johann Blake |
last post by:
You can read an article on a novel approach on how to build an
inexpensive system to track a vehicle or any other type of object
using a GPS receiver and other off-the-shelf hardware like a GSM/GPRS
modem. The article is found at:
http://www.closerworlds.com/eng/Resources/GPS_Vehicle_Tracking.html
This is part I in a series.
By CloserWorlds
|
by: jimfortune |
last post by:
In:
http://groups.google.com/group/comp.databases.ms-access/msg/60d7faa790c65db1
james.ea...@gmail.com said:
:Ok, I've answered the first half of my own question. From a MSDN
:article, I can now use the following to reference the last primary
:key's values:
:
|
by: Jesse Johnson |
last post by:
I dont know if this question belongs in here, but I will try. Does anyone
know where I could get a veicle sales DB??? Example: someone comes to the web
app and they see "select make" then "selct model" then "select year" and
finally "select options". Does anyone know if there is a datasource out there
for this info? Thanks in advance.
--
Jesse Johnson
|
by: javelin |
last post by:
I posted an answer to someone's question, and realized I have more
questions than answers. Thus, I am going to post my scenario to get to
the question that I have:
I have a challenge, to figure out what part of the vehicle to relate
parts to. I can't relate a part to the entire vehicle. Why? Well, a
vehicle can have, apparently, more than one engine configuration. For
example, I have a Honda Civic with a 1.5L engine, and it can come with...
| |
by: MLH |
last post by:
Suppose you have tblVehicleJobs with keyfield.
And say there's another table used to keep records of inbound
letters you receive on each car. That table is named tblinLttrs
and has as it's keyfield and has field
which is used to link it to tblVehicleJobs.
Since many letters (of several categories) could be sent in over
time pertaining to a given vehicle, there is a hard-coded One To
Many relationship from tblVehicleJobs to tblinLttrs...
|
by: vince |
last post by:
Until December, 31st, 2008 companies may obtain a free Developer
License of the JOpt.NET Vehicle Routing Library
The Vehicle Routing Initiative aims on software vendors that plan to
incorporate advanced route planning and optimization features into
their existing software product. Be it in Logistics, Field Service or
Sales Force Planning ISVs are encouraged to contact DNA at
http://www.dna-evolutions.com/vrinitiative.html
|
by: vince |
last post by:
Until December, 31st, 2008 companies may obtain a free Developer
License of the JOpt.SDK Vehicle Routing Library
The Vehicle Routing Initiative aims on software vendors that plan to
incorporate advanced route planning and optimization features into
their existing software product. Be it in Logistics, Field Service or
Sales Force Planning ISVs are encouraged to contact DNA here to obtain
a free Developer Express License including email...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |