تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
سؤال عن لغة c# ارجو حله اليوم قبل الساعة 10
#1
it).
Work requested for this home work:
In this assignment you will write a code to model the behavior of a small fuel pump (محطة وقود ). Fuel pumps are used to pump petrol/gasoline, diesel, kerosene, or other types of fuel into vehicles and calculate the financial cost of the fuel sold.
Our fuel pump station has only one dispenser ( مضخة ) which dispenses only two types of fuel: gasoline (كاز ) and diesel (ديزل ).
Write the following two classes:
1. Class named Tank with the following members:
 private fields
a) FuelType: store the type of the fuel (gasoline or diesel) in the tank, 'g' for gasoline, 'd' for diesel.
b) fuelQuantity: store the amount of the fuel (gasoline or diesel) in the tank in Liter
c) costPerLiter: store the prices per Liter of the fuel in the tank.
d) fuelSold: store the amount of the overall sold fuel from the tank (in Liter)
 public methods:
1- Default constructor to initialize fields.
2- A constructor with 4 parameters to set the fields of the class.
3- 4 set and 4 get methods for the FuelType, fuelQuantity, costPerLiter, and fuelSold fields.
2. Class named FuelPump that contains the following members:
 private field:
1- TankList of type Tank: an array of 2 elements to store the information of the two tanks (Tank 1 and Tank 2)
 public methods:
1- A constructor with 6 parameters to set the values of FuelType, fuelQuantity and costPerLiter for each tank in the array. The fuelSold for each tank initialized to 0.
CPE 311
Assignment-1
Instructor: Eng. Mohammed Al-Hammouri
Deadline: Saturday 20/10/2016 by 22:00
2- A method called SetPricePerLiter with two parameters to give a new price (per Liter) for each type of fuel.
3- A method called BuyFromSupplier (الشراء من مزود الوقود ) with two parameters: (quantity and the type of fuel), that allows buying a quantity of fuel in Liter from supplier.
4- A method called Sell (بيع الوقود للزبائن ) with two parameters: quantity in liters and type of fuel to sell an amount of fuel to a customer by Liter. This function should also prints out the customer’s bill.
5- A method called Reset to reset the amount of sold fuel for each tank to 0
6- A method called DisplayInfo to print out amount of fuel in tank1 and tank2, and the fuel prices in JD per Liter.
7- A method called DisplaySoldInfo to print out the total amount of sold fuel (in Liters) for each tank and the total amount of money earned during the pay period.
3. In the Main
 Declare an object of type FuelPump, with the following information for each tank. Tank1: gasoline, 200 Liters, 0.83JD, Tank2: diesel, 120 Liters, 0.55JD.
 Allow the following Menu to appear:
***************************
Fuel Pump Modeling Program
***************************
1 - Display Information for each Tanks
2 - Set a new price
3 - Buy from a supplier
4 - Sell to customer and Display customer’s bill
5 - Display the total sold fuel for each tanks and the total
amount of money earned during the pay period.
6 - Reset sold fuel.
7 - Exit
***************************
Choice:
الرد }}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم