Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASSIGNMENT CPE362 SUBMITTED BY AGWELI BRAIMOH ISAAC ENG1810267 #56

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added CPE362 UML ASSIGNMENT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DemoInterfaceCar.class
Binary file not shown.
7 changes: 7 additions & 0 deletions DemoInterfaceCar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public interface DemoInterfaceCar {
public static final double TOO_FAST_KPH = 160.9;

// Methods in an interface are abstract without using te keyword.
public boolean slowDown(double amount);
public boolean speedUp(double amount);
}
Binary file added DemoMain.class
Binary file not shown.
25 changes: 25 additions & 0 deletions DemoMain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Utility class to execute DemoUseInterfaceCar.java and DemoInterfaceCar.java
*/

public class DemoMain {
public static void main(String[] args) {
// Declare and initialize a DemoUseInterfaceCar object
DemoUseInterfaceCar demoCar = new DemoUseInterfaceCar(7, 5.65);

// call getter methods of demoCar object
int numberOfPassengers = demoCar.getNumberPassengers();
double speed = demoCar.getSpeed();
double getTooFastKph = demoCar.getTooFastKPH();

// Output instance variables of the demoCar object
System.out.println("Number of passengers: " + numberOfPassengers);
System.out.println("Get speed: " + speed);
System.out.println("Get too fast kph: " + getTooFastKph);


// call methods of demoCar object
demoCar.slowDown(5.5);
demoCar.speedUp(6.38);
}
}
Binary file added DemoUseInterfaceCar.class
Binary file not shown.
35 changes: 35 additions & 0 deletions DemoUseInterfaceCar.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
public class DemoUseInterfaceCar {
private int numberPassengers;
private double speed;

public DemoUseInterfaceCar(int numberPassengers, double speed) {
this.numberPassengers = numberPassengers;
this.speed = speed;
}

public int getNumberPassengers() {
return numberPassengers;
}

// Implement the methods declared in DemoInterfaceCar
public boolean slowDown(double amount) {
System.out.println("slowDown amount: " + amount);
return true;
}

public boolean speedUp(double amount) {
System.out.println("speedUp amount: " + amount);
return true;
}

// getters method
public double getSpeed() {
return speed;
}

public double getTooFastKPH() {
return DemoInterfaceCar.TOO_FAST_KPH;
}


}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# SoftTeam22
# SoftTeam22 AGWELI BRAIMOH ISAAC ENG1810267"
2 changes: 1 addition & 1 deletion test branch
Original file line number Diff line number Diff line change
@@ -1 +1 @@
300l cpe assignment
300l cpe assignment