Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 10 pages
Exam (elaborations)

COM SCI 130 – Winter 2026 Practice Midterm 1 with Full A+ Solutions (UCLA Computer Science)

Document preview thumbnail
Preview 2 out of 10 pages

COM SCI 130 – Winter 2026 Practice Midterm 1 with Full A+ Solutions (UCLA Computer Science)

Content preview

Winter 2026 Midterm Practice Questions

1. UML Class Diagram
Write a full java program based on the following UML class diagram. Any details not shown in
the diagram can be omitted in your answer.




public abstract class Vehicle {​
public abstract void move(double d);​
public abstract void stop();​
public abstract void turn(double d);​
}​

public class Car extends Vehicle {​
private double mMileage;​
private double mSpeed;​
private Axle[] axle;​

@Override​
public void move(double d) { ... }​

@Override​
public void stop() { ... }​

@Override​

, public void turn(double d) { ... }​

public void setSpeedMPH(double d) { ... }​
public double getSpeedMPH() { ... }​
public double getSpeedKPH() { ... }​

private void setMileage(double d) { ... }​
}​

public class Bicycle extends Vehicle {​
@Override​
public void move(double d) { ... }​

@Override​
public void stop() { ... }​

@Override​
public void turn(double d) { ... }​
}​

public class RollerSkates extends Vehicle {​
@Override​
public void move(double d) { ... }​

@Override​
public void stop() { ... }​

@Override​
public void turn(double d) { ... }​
}​

public class Axle {​
private Wheel[] wheel;​

public void addWheel() { ... }​
public void spin() { ... }​
}​

public interface Wheel {​
void roll();​
}



The axle and wheel fields do not need to be private.
But m_Mileage and m_Speed have to be private as indicated by the UML diagram.

Document information

Uploaded on
August 2, 2026
Number of pages
10
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
£14.08

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
wisenurse
5.0
(1)
Sold
33
Followers
2
Items
923
Last sold
3 days ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions