Free University of Bolzano/Bozen
Faculty of Computer Science - Bachelor in Applied Computer Science
Bachelor in Production Engineering
Introduction to Programming - A.A. 2006/2007

Exercise 5

Primitive data types

Exercise 5A

Implement a class Bookstore for representing bookstores having books in two languages: Italian and German. Each Bookstore object should maintain the following information:

The Bookstore class should export to its clients the following methods:

Finally, implement a client class which:


Exercise 5B

Plan and implement a class Car with the following properties:

The class Car should define the following methods:

Furthermore, design and implement a client class with a static method getCurrentValue that computes the car's current value, given a car object and the current year. Use the equation:

currentValue = basePrice * 0.8 ^ (currentYear - acquisitionYear)

where "a ^ b" means "a to the power b". Use the pow method from the java.lang.Math package.