Xandro_2000
New member
- Joined
- Dec 29, 2020
- Messages
- 2
- Programming Experience
- Beginner
Hello
I got an mock exam to practice, my real exam is in two weeks. I'm studying to become a teacher (this is an extra class I took) but with corona I had so many things to do including internship, etc. So I really I did not have a lot of time to practice C sharp. I only understand the basics, for this mock exam (check under this paragraph) I only created the classes (barrel, normalBarrel, reserveBarrel and Program itself). I have no clue how to start, I know I first have start with making all the barrels (automatic), then the consumption, refill, etc. Can someone explain me what to do or write me an example code. Thanks!
Mock exam
A beverage consumer wants a program to monitor his barrels. He can purchase two different products, product A and product B. The program requires the following input:
How many Barrels of product A do you want?
3
How many Barrels of product B do you want?
1
Done
You can consume product A and B.
The correct amount of barrel objects is automatically created with this data. For each product where barrel objects are created, with a capacity and content (expressed in liters) for each product, a spare barrel is also created with a capacity of double the total capacity of all barrels of that product together.
The beverage consumer can consume these products (expressed in liters), whereby the content (expressed in liters) of the consumed barrel object decreases with the amount of liters consumed.
When the content of a barrel object is less than 50% of its capacity, the content of this barrel object is supplemented with the spare barrel of that product.
Each barrel has an alarm function that is checked after each consume or fill. The alarm can print one of the following messages:
And last but not least. I make dummy proof! You cannot consume more than the content of the barrel. You cannot fill the barrel more than the capacity of the barrel. If you do one of these options, the functions “Fill” and “Consume” will automatically take the respective minimum and maximum.
Each barrel object has the following attributes and methods:
- consume (expressed in liters) - alarm → I am full
→ I am empty → I need a refill
- showContent (expressed in liters) - consume (expressed in liters)
- alarm → I am empty
Write your own main () in which you demonstrate that all these functionalities work. You will be assessed on the following matters:
I got an mock exam to practice, my real exam is in two weeks. I'm studying to become a teacher (this is an extra class I took) but with corona I had so many things to do including internship, etc. So I really I did not have a lot of time to practice C sharp. I only understand the basics, for this mock exam (check under this paragraph) I only created the classes (barrel, normalBarrel, reserveBarrel and Program itself). I have no clue how to start, I know I first have start with making all the barrels (automatic), then the consumption, refill, etc. Can someone explain me what to do or write me an example code. Thanks!
Mock exam
A beverage consumer wants a program to monitor his barrels. He can purchase two different products, product A and product B. The program requires the following input:
How many Barrels of product A do you want?
3
How many Barrels of product B do you want?
1
Done
You can consume product A and B.
The correct amount of barrel objects is automatically created with this data. For each product where barrel objects are created, with a capacity and content (expressed in liters) for each product, a spare barrel is also created with a capacity of double the total capacity of all barrels of that product together.
The beverage consumer can consume these products (expressed in liters), whereby the content (expressed in liters) of the consumed barrel object decreases with the amount of liters consumed.
When the content of a barrel object is less than 50% of its capacity, the content of this barrel object is supplemented with the spare barrel of that product.
Each barrel has an alarm function that is checked after each consume or fill. The alarm can print one of the following messages:
- - I am full
- - I am empty
- - I need a refill
A reserve barrel has a “show content” method that displays the current content of the reserve barrel. This method is called every time after consuming from the reserve barrel. The reserve barrel also has an alarm with the following functionality:
And last but not least. I make dummy proof! You cannot consume more than the content of the barrel. You cannot fill the barrel more than the capacity of the barrel. If you do one of these options, the functions “Fill” and “Consume” will automatically take the respective minimum and maximum.
Each barrel object has the following attributes and methods:
- - name or ID
- - type (product A or B)
- - capacity (expressed in liters)
- - content (expressed in liters)
Each spare barrel object has the following attributes and methods: - - name or ID
- - type (product A or B)
- - capacity (expressed in liters)
- - content (expressed in liters)
- consume (expressed in liters) - alarm → I am full
→ I am empty → I need a refill
- showContent (expressed in liters) - consume (expressed in liters)
- alarm → I am empty
Write your own main () in which you demonstrate that all these functionalities work. You will be assessed on the following matters: