Nhờ các PRO vào làm giúp kái đề PCS này với
Trang 1 trong tổng số 1 trang
Nhờ các PRO vào làm giúp kái đề PCS này với
Nhờ các Pro vào làm cho đề này:(
Question 1 [13.5]
I. Create an interface IGood that has the following properties: [1]
- int Price Read / Write
- string Stock Read /Write
- float VAT Read-only
- float PriceCal Read-only
II. Create an abstract class named Product do the following tasks: [6]
1. Fields – private [0.5]
- int _id : Product id
- string _name : Product name
2. Create constructor methods: [3]
• First constructor declare with one parameter int id then assign to product id, the product name assign with default value "No name".
• Second constructor declares with two parameters int id, string name then assign to product id and product name.
3. Properties – public [2]
• int ID – Read-only property return product id
• string Name – Read/Write property of product name. Student must write statements to throw new Exception when the input value has length less than 3 characters.
4. Abstract method - public [0.5]
• void ShowInfo: without parameters.
III. Declaring class named Laptop inherits from abstract class Product and implement interface IGood then do following task: [6.5]
1. Fields – private [0.5]
• int _price : Product price
• float _vat: VAT for product
• string _stock: Stock name
2. Constructor methods: [2]
• First constructor with one parameter int id : call base constructor and assign default value 0 for _price and 0.1 for _vat
• Second constructor with three parameters: int id, string name, int price. Call base constructor with two parameters (id, name) then assign price to _price and default value 0.1 for _vat
3. Properties – public [3]
• int Price: implement from IGood read and write product price. Note student must write statements to throw new Exception when input value less than 0 [1]
• string stock: implement from IGood read and write the stock name [0.5]
• float VAT: implement from IGood read-only return _vat of product [0.5]
• float PriceCal: implement from IGood read-only return the price include VAT
_price * (1 + _vat) [1]
4. Method – public [1]
• void ShowInfo: Show all product information with the format as:
[You must be registered and logged in to see this image.]
Question 2 [11.5]
I. Create a class named LaptopList do the following tasks: [7.5]
1. Field – private [0.5]
• Declare a generic List<Laptop> named llist
2. Constructor method: [1]
• Declare a constructor method with one parameter int capacity to init llist with capacity from the parameter
3. Property, Indexer – public [2.5]
• Declare an indexer will allow using [] notation on the class instance itself: Student must throw new Exception when index out of range. [2]
• int Count: return number of items in llist [0.5]
4. Methods – public [3.5]
• void AddLaptop: method have one parameter Laptop lab, allow add Laptop item to llist. Student must throw new Exception when llist out of capacity.[1.5]
• int ShowFilterLaptop: method have one parameter float maxprice, show all information's of Laptop item which have Price include VAT less than or equal maxprice. Result return number of above items [2]
II. Create a class to test classes: [4]
1. Define an instance of LaptopList class named mylist with input three arguments.[0.5]
2. Write statements to input 3 Laptop items then add to mylist. Student must use try catch to catch exception when input. [2]
3. In the console, input a value (max price) then invoke ShowFilterLaptop with mylist to Display which Laptop item have Price include VAT less than or equal max price. [1.5]
Show all information just entered to the screen: (see next page)
[You must be registered and logged in to see this image.]
Question 1 [13.5]
I. Create an interface IGood that has the following properties: [1]
- int Price Read / Write
- string Stock Read /Write
- float VAT Read-only
- float PriceCal Read-only
II. Create an abstract class named Product do the following tasks: [6]
1. Fields – private [0.5]
- int _id : Product id
- string _name : Product name
2. Create constructor methods: [3]
• First constructor declare with one parameter int id then assign to product id, the product name assign with default value "No name".
• Second constructor declares with two parameters int id, string name then assign to product id and product name.
3. Properties – public [2]
• int ID – Read-only property return product id
• string Name – Read/Write property of product name. Student must write statements to throw new Exception when the input value has length less than 3 characters.
4. Abstract method - public [0.5]
• void ShowInfo: without parameters.
III. Declaring class named Laptop inherits from abstract class Product and implement interface IGood then do following task: [6.5]
1. Fields – private [0.5]
• int _price : Product price
• float _vat: VAT for product
• string _stock: Stock name
2. Constructor methods: [2]
• First constructor with one parameter int id : call base constructor and assign default value 0 for _price and 0.1 for _vat
• Second constructor with three parameters: int id, string name, int price. Call base constructor with two parameters (id, name) then assign price to _price and default value 0.1 for _vat
3. Properties – public [3]
• int Price: implement from IGood read and write product price. Note student must write statements to throw new Exception when input value less than 0 [1]
• string stock: implement from IGood read and write the stock name [0.5]
• float VAT: implement from IGood read-only return _vat of product [0.5]
• float PriceCal: implement from IGood read-only return the price include VAT
_price * (1 + _vat) [1]
4. Method – public [1]
• void ShowInfo: Show all product information with the format as:
[You must be registered and logged in to see this image.]
Question 2 [11.5]
I. Create a class named LaptopList do the following tasks: [7.5]
1. Field – private [0.5]
• Declare a generic List<Laptop> named llist
2. Constructor method: [1]
• Declare a constructor method with one parameter int capacity to init llist with capacity from the parameter
3. Property, Indexer – public [2.5]
• Declare an indexer will allow using [] notation on the class instance itself: Student must throw new Exception when index out of range. [2]
• int Count: return number of items in llist [0.5]
4. Methods – public [3.5]
• void AddLaptop: method have one parameter Laptop lab, allow add Laptop item to llist. Student must throw new Exception when llist out of capacity.[1.5]
• int ShowFilterLaptop: method have one parameter float maxprice, show all information's of Laptop item which have Price include VAT less than or equal maxprice. Result return number of above items [2]
II. Create a class to test classes: [4]
1. Define an instance of LaptopList class named mylist with input three arguments.[0.5]
2. Write statements to input 3 Laptop items then add to mylist. Student must use try catch to catch exception when input. [2]
3. In the console, input a value (max price) then invoke ShowFilterLaptop with mylist to Display which Laptop item have Price include VAT less than or equal max price. [1.5]
Show all information just entered to the screen: (see next page)
[You must be registered and logged in to see this image.]
phongvan1991- Level 0
- Tổng số bài gửi : 1
Join date : 06/01/2012
Trang 1 trong tổng số 1 trang
Permissions in this forum:
Bạn không có quyền trả lời bài viết
|
|
Fri Jan 10, 2014 5:08 pm by trangan
» Luvina - Tuyển sinh Luvina Academy IX/2013
Tue Apr 09, 2013 2:21 pm by trangan
» LUVINA ACADEMY VIII TUYỂN SINH 2012
Mon Sep 17, 2012 3:16 pm by trangan
» Tuyển sinh khóa học lập trình viên_Luvina Academy VII (Hệ sơ cấp)
Tue Jul 10, 2012 7:01 pm by trangan
» Xin đề thi thực hành,lý thuyết và đáp án của môn Developing Web Services with Java
Tue Jan 10, 2012 12:58 pm by JinHoVN
» Nhờ các PRO vào làm giúp kái đề PCS này với
Fri Jan 06, 2012 1:06 pm by phongvan1991
» Đề cương ôn tập môn CF
Thu Nov 10, 2011 8:20 pm by thanhnc_b01392
» xin slide môn C
Sun Sep 04, 2011 5:33 pm by anhchang064
» Drugs In Japan
Tue Aug 02, 2011 5:58 am by Khách viếng thăm