联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp2

您当前位置:首页 >> Java编程Java编程

日期:2020-06-08 11:16

ASSIGNMENT 2 Part A

Due Tuesday 24/4/20 18:00*

*Late submissions will incur penalties

Build a controller for a microwave.

Take keyboard inputs

For this you MUST use getchar() scanf is not allowed

1. Take the following inputs

Character Meaning

0->9 Digits 0 to 9

s Start cooking

c Cancel Cooking

+ Add 30 seconds

p1 - p5 Change power setting 1 to 5

1 = 20% means 1 second in every 5

3 = 60% means 3 seconds in every 5

5 = 100% means 5 seconds in every 5

d open/close door

Ignore if key entered is not applicable currently

2. Create the following variables (you will need more than these, but must use

these)

a. int cookTimeRemaining

b. char powerSetting

c. char InteriorLamp

d. char doorOpen

e. char heatingElement

Plus any others that you need

3. Do not allow start to be pressed if the door is open.

4. If the door has not been opened after the cook finishes, do not accept any inputs

5. If the door is opened, pause the cook cycle

6. If + is pressed

a. During cook, or before cook add 30s to the clock time.

b. After cook is finished but before the door is opened - ignore

7. If cancel is pressed

a. During the cook - pause cook

b. While not cooking

i. Clear time

ii. Reset power to 5

8. Turn on the lamp

a. When the door is open

b. When cooking

Output the following:

9. Print the heating element status when it changes

10.Print the lamp status when it changes

11.Print the door status when it changes

12.When starting cook, print ‘Cook Started’

13.During cook print every second, print the time remaining

14.When cook completes print “Ready - Enjoy your meal”

To gain 100% you MUST have output that looks like the following 3 examples(Red is

user input)

(anything in blue is a note from me, do not print)

You may add extra output if you think it is relevant.

Ready - Enjoy your meal

+ //program to ignore this

12 //program to ignore this

s //program to ignore this

1:04

552 //program to ignore this

Heating Off

1:03

p //program to ignore this


版权所有:编程辅导网 2018 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。