University stuff.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Oppgave51.java 510B

1234567891011121314151617181920212223
  1. class Oppgave51 {
  2. public static void main(String[] args) throws Exception {
  3. Bil bil = new Bil(60, 5);
  4. try {
  5. System.out.println("Kjorer 10 km.");
  6. bil.kjorTur(10);
  7. System.out.println("Kjorer 250 km.");
  8. bil.kjorTur(250);
  9. System.out.println("Kjorer 3 km.");
  10. bil.kjorTur(3);
  11. System.out.println("Kjorer 9001 km.");
  12. bil.kjorTur(9001);
  13. } catch (Exception e) {
  14. System.out.println(e.getMessage());
  15. }
  16. System.out.println("Bilen har kjort "+bil.hentKilometerstand()+" km.");
  17. }
  18. }