Question

(Java Problem)In this question we will step you through implementing classes and methods in Java for...

(Java Problem)In this question we will step you through implementing classes and methods in Java for a new ride-sharing app called Rebu. Rebu connects passengers looking for a ride with drivers in their area. You can assume that the classes or methods in earlier questions “exist” in later questions, even if you haven’t answered the question. You must follow proper Object Oriented Design principles, and Java programming conventions. Write all class declarations. Do not write method signatures that are given to you. [30 marks]

(e) Implement a Driver class. A Driver is defined by their location in the world, as well as the passenger they are currently driving. Your class should include a constructor, but do not write getters and setters. [3 marks]

0 0
Add a comment Improve this question Transcribed image text
Answer #1


class Driver{
  
String location;
String passenger;
  
Driver(String location ,String passenger){
  
this.location = location;
this.passenger= passenger;
  
  
}
  
  
  
  
}

public class Main{
  
public static void main(String[] args){
  
Driver d= new Driver("stefen","India");
  
System.out.println("location is " + d.location + "\n passenger name is "+ d.passenger);
  
}
  
}

e cr e99 Save up to g0% × 之 C+-pointer to obiects x 2 50tware Engineer San x 2 c+--5 ap two objects GG IDE Geeksto Gee s A x C (Java Problem jin This CSecure https/ide geeksforgeeks.org School Programming Company Preparation Quiz Corner Placements Haw to pick a difficulty level? Time(sec): 0.07 Memory(MB): 55.9062 Output: Copy Ad closed by Google Report this ad Why this ad? loration is stefon passenger nane i> Indie Ad closed by Google Report this ad Why this ad? We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Agtivate Wind Got it O Type here to search R A 4 2239 02-09-2018

Add a comment
Know the answer?
Add Answer to:
(Java Problem)In this question we will step you through implementing classes and methods in Java for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In Java. Implement the classes shown in the following two pictures. Test your classes and methods...

    In Java. Implement the classes shown in the following two pictures. Test your classes and methods (you do not need to test the getters and setters). MyPoint class is the same as the MyPoint class of Problem 3. 3 MyPoint -x:int vertices -y:int My Triangle -v1: MyPoint -v2: MyPoint -V3: MyPoint +My Triangle(x1:int, yl:int, x2:int,y2:int,x3:int, y3:int) +MyTriangle(v1: MyPoint, v2: MyPoint, v3: MyPoint) +toString():String +getPerimeter(): double +getType(): String "My Triangle[v1=(x1, y1),v2=(x2, y2), v3=(x3,73)]" "Equilateral" or "Isosceles" or "Scalene"

  • In this lab you will work with abstract classes/interfaces. (Java Program) You will be implementing a...

    In this lab you will work with abstract classes/interfaces. (Java Program) You will be implementing a basic employee schema within a company. The Employee class will be an abstract class that will contain methods applicable to all employees. You will then create 2 classes called SoftwareEngineer and ProductManager. Both are different employee types based on occupation. You will create an interface called Developer which will consist of specific methods that apply to only Developers (e.g. SoftwareEngineer class will implement this,...

  • You are given a specification for some Java classes as follows.   A building has a number...

    You are given a specification for some Java classes as follows.   A building has a number of floors, and a number of windows. A house is a building. A garage is a building. (This isn’t Florida-like … it’s a detached garage.) A room has a length, width, a floor covering, and a number of closets. You can never create an instance of a building, but every object that is a building must have a method that calculates the floor space,...

  • Write Java classes CollectableItem and Coin defined by these UML    diagrams . CollectableItem is the...

    Write Java classes CollectableItem and Coin defined by these UML    diagrams . CollectableItem is the base class for the derived class Coin. If you wish, use    IntelliJ to write the constructors, getters, setters, and toString    methods.    +---------------------------------------------------------------+    |                 CollectableItem                               |    +---------------------------------------------------------------+    | - id : int                                                    |    | - itemType : String                                           |    | - price : double                                              |    | - onSale : boolean                                            |    +---------------------------------------------------------------+    | +...

  • Write an ADT named circle in java containing the following. Include data: radius (double) Include methods:...

    Write an ADT named circle in java containing the following. Include data: radius (double) Include methods: A no-argument constructor A constructor that sets the data to passed values Getters and setters for each piece of data getArea (Math.PI * radius * radius … try using a Math method here) getDiameter (radius * 2) getCircumference (2 * Math.PI * radius) A toString( ) method to display the object data Include Javadoc comments for the class and every method, and generate the...

  • Java Lab In this lab, you will be implementing the following class hierarchy. Your concrete classes...

    Java Lab In this lab, you will be implementing the following class hierarchy. Your concrete classes must call the superclass constructor with the proper number of sides (which is constant for each concrete shape). The perimeter method is implemented in the superclass as it does not change based on the number of sides. The area method must be overridden in each subclass as the area is dependent on the type of polygon. The areas of an equilateral triangle, square, and...

  • In this assignment, you will implement Address and Residence classes. Create a new java project. Part...

    In this assignment, you will implement Address and Residence classes. Create a new java project. Part A Implementation details of Address class: Add and implement a class named Address according to specifications in the UML class diagram. Data fields: street, city, province and zipCode. Constructors: A no-arg constructor that creates a default Address. A constructor that creates an address with the specified street, city, state, and zipCode Getters and setters for all the class fields. toString() to print out all...

  • Java file Name Dog Classes and Methods Create a constructor that incorporates the type, breed, and...

    Java file Name Dog Classes and Methods Create a constructor that incorporates the type, breed, and name variables (do not include topTrick). Note: The type refers to what the breed typically does; for example, a corgi would be a “cattle herding dog.” A Shiba Inu would be a “hunting dog.” Create the setTopTrick() mutator method Dog is parent class Corgi and Driver are subclasses Complete the Corgi class: Using the UML Class diagram, declare the instance variables. Create the two...

  • Please help me with this code. Thank you Implement the following Java class: Vehicle Class should...

    Please help me with this code. Thank you Implement the following Java class: Vehicle Class should contain next instance variables: Integer numberOfWheels; Double engineCapacity; Boolean isElectric, String manufacturer; Array of integers productionYears; Supply your class with: Default constructor (which sets all variables to their respective default values) Constructor which accepts all the variables All the appropriate getters and setters (you may skip comments for this methods. Also, make sure that for engineCapacity setter method you check first if the vehicle...

  • JAVA :The following are descriptions of classes that you will create. Think of these as service...

    JAVA :The following are descriptions of classes that you will create. Think of these as service providers. They provide a service to who ever want to use them. You will also write a TestClass with a main() method that fully exercises the classes that you create. To exercise a class, make some instances of the class, and call the methods of the class using these objects. Paste in the output from the test program that demonstrates your classes’ functionality. Testing...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT