Arrays and bitwise operations
In a nuclear plant there are 50 displays, each of them has 4 LEDs to show if there are some emergencies in progress.
LED 0: Core Overheating
LED 1: Core Low Power
LED 2: Radiation Leak
LED 3: Warning Siren (active if and only if at least one of the previous warnings is ON)
Futrhermore, the building is splitted into two wings:
Wing 1: Displays 0-24
Wing 2: Displays 25-49
Implement a program in which the user can control these displays, one by one.
⦁ Each display shall be represented with an unsigned int variable
⦁ +The displays themselves shall be declared as an array of such unsigned int
⦁ Each LED is represented by a bit in such unsigned int variable. For instance:
Display 0: bit.0 is the Core Overheating LED of the first display. When Core Overheating is ON, display == 9 because both bit.0 (Core Overheating) and bit.3 (Warning Siren) are set
Display 49: bit.3 is the Warning Siren LED of the 50th display. When the Warning Siren is ON, display is > 8 because we need LED3 (bit.3) active + AT LEAST another LED active
⦁ The user shall first specify the display of interest
⦁ The user shall specify which wing such display is part of
⦁ If the user wants to act on a display which is in the other wing, the action must be forbidden (e.g. I want to turn ON an LED on display 2 of wing 2 ==> Error because display 2 is in wing 1)
⦁ The user shall be able to turn ON or to turn OFF an LED of the previously specified display. If the display is already in the desired state, nothing should change
⦁ The user shall be able to retrieve the information about a specified display, which will be printed on screen using this template:
Information of Display 23 - Wing 1
Core Overheating: 1
Core Low Power: 0
Radiation Leak: 0
Warning Siren: 1
⦁ The Warning Siren LED (bit.3) can't be changed directly by the user, it must be turned ON/OFF automatically depending on the current state of the other three LEDs
⦁ The function to change the LEDs status must be implemented outside main()
⦁ Use bitwise operations to set/clear the LEDs. (operators: | & << >> |= &= )
7 freelancers are bidding on average €32 for this job
Hi I have a lot of experience with C and bitwise operations and can help you with your problem. I can start working immediately, so if you're interested, I'd love to discuss more about this in chat.
Hi, I have a lot of experience in using C like the tasks you mentioned about. I am a senior computer science student and I completed lots of tasks like that. I can definitely help you. Thank you!