Java代写 | Training Exercises 6


Exercise .1: write a program to set the lamp bulb status
ON or OFF.

1. Create a class called Lamp,

2. In the class Lamp add the Boolean attribute to represent
the status of the Lamp (True = Lamp is On, False = Lamp is

3. In the class Lamp add methods to:
• Change the Statutes of the lamp from ON to OFF or
from OFF to ON.
• To print the status of any lamp,

4. Create the Test Program,

Exercise .2: A pets shop sales three kinds of pets (Cats, Dogs, and
Birds). Write a program that calculate the sales price based on
purchased pets price and daily expenses with a profit of 0.15 for all
types of pets, according to the following formula:

Sales Price = (Purchased Price + days * daily expenses ) * 0.15

1. Create a pet class that has:
• Constructors.
• Pet attributes.
• Getter and setter.
• Sales cost method.

2. Test Class.

Examples: Suppose you are a project manager and you want to ship your
products from China to Germany in regular bases, You have several
products to be shipped:

1- Laptop has a box size: 60x50x50 cm and weight of 6.5 kg.
2- Mouse has a box size: 30x30x20 cm and weight of 200 g.
3- Desktop has a box size 100x150x50 cm and weight of 20 kg.

You have at the same time 2 different shipping options:

1- Small Container with 2.59m height, 2.43m wide, and 6.06m length.
2- Big Container with 2.59m height, 2.43m wide, and 12.01m length.

The shipping cost for big container is 1800 Euro what ever the shipment
weight is.

The shipping cost for small container 1000 Euro for 500 kg or less, and 1200
Euro for more.

Write a program that calculate the best shipping methods according to
your regular shipping products.


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail:  微信:itcsdx