سلااام عليكم
انا طالب في جامعه الملك عبدالعزيز الترم دا اخذت برمجه بلغه الجافا
الدكتور اعطانا دا السؤال
فكرت فيه ما عرفت حله ياليت الي يعرف يحله يساعدني فيه
Write a java class named as Product.java representing a product you purchase from a supermarket. This class should have the following information about the Product:
• Product Name (String). (e.g. Milk , Chocolate, Tea e.t.c.)
• Company Name (String) (Al-marai, Galaxy , Lipton e.t.c)
• Make Date (Date). (Date of Make of Almarai Milk printed on the Bottle )
• Product Count( int) ( No of Products in the supermarket e.g. 5 )
Customer can visit and purchase the products from the supermarket. When the customer purchase a product its date of expiry must be displayed which is 1 week from the Make Date. Let’s assume that The Super Market has 5 different Products.
The Products class should have eight methods
• setProductName (String name) for setting the name of the Product.
• getProductName ( ) for returning the name of the Product.
• setCompanyName(String name) for setting the name of the Company of a Product.
• getCompanyName ( ) for returning the name of the Company of a Product.
• check ( ) for checking the availability of a Product in the super Market.
• setMakeDate (Date) for setting the Make date of a Product.
• getMakeDate (Date) for returning the Make date of a Product.
• toString() for printing a report that contains all of Products purchased from the super market.
Write a Java application (Main class) called ProductTest.java that lets the user to create six Objects of Product Class and then prints a report that contains all the five products purchased by a customer.
Sample output:
Enter name of First Product you want to Purchase: Milk
Enter the Product Company Name: Al-marai
You can purchase the Al-marai Milk
You purchased this product on 11-07-2010 This Product will expire after 1 week
Enter name of Second Product you want to Purchase: Chocolate
Enter the Product Company Name: Galaxy
You can purchase the Chocolate Galaxy
You purchased this product on 11-07-2010
This Product will expire after 1 week
Enter name of Third Product you want to Purchase: Tea
Enter the Product Company Name: Lipton
You can purchase the Tea Lipton
You purchased this product on 11-07-2010
This Product will expire after 1 week
Enter name of Fourth Product you want to Purchase: Laban
Enter the Product Company Name: Nadec
You can purchase the Nadec Laban
You purchased this product on 11-07-2010
This Product will expire after 1 week
Enter name of Fifth Product you want to Purchase: Yoghurt
Enter the Product Company Name: Al-marai
You can purchase the Al-marai Yoghurt
You purchased this product on 11-07-2010
This Product will expire after 1 week
Enter name for Sixth Product Purchased: Labnah
Enter the Product Company Name: Nadec
Sorry Nadec Labnah is out of order
============the report from the Super Market===========
Al-marai Milk is purchased on 11-07-2010, expiry date of this product is 11-14-2010
Galaxy Chocolate is purchased on 11-07-2010, expiry date of this product is 11-14-2010
Lipton Tea is purchased on 11-07-2010, expiry date of this product is 11-14-2010
Nadec Laban is purchased on 11-07-2010, expiry date of this product is 11-14-2010
Al-marai Yoghurt is purchased on 11-07-2010, expiry date of this product is 11-14-2010
Sorry Nadec Labnah is out of order
اخوكم احمد

