Question: EGR107 Assignment Structures and States EGR107 Assignment #3: Structures and States Requirements: The homework is to be turned in on Blackboard You must upload .c

EGR107 Assignment Structures and States EGR107 Assignment #3: Structures and States Requirements: The homework is to be turned in on Blackboard You must upload .c and/or .ino files. Make sure you save the files as LASTNAME_Q1_3 OR ..Q4 (question #) .c files must compile and run correctly from Codeblocks (Q1 Q3) and Arduino IDE (Q4). A .c or .ino file that does not compile will score a 0 for that question. Create one file for Q1-Q3 and one file for Q4. INDIVIDUAL WORK, no group work allowed

Q1) [20 PTS] Declare a structure whose tag name is Book and that contains exactly three fields (or members), each of type int: the first field is nCopies the second field is nPages the third field is nAuthors

Q2) [30 PTS] Declare a structure whose tag name is emp that contains these fields (in the following order): a double field named d a character pointer named str an array of eleven integers named arr In addition, declare an array named emp of 30 of these structures. Assign the value 12 to the last element of the arr field of the last element of emp. Assign 3.5 to the d field of the first emp element. Assign the string Hello to the kth element of emp. (assign k as 12 before making the assignment).

Q3) [25 PTS] Define a structure type element _t to represent one element from the periodic table of elements. Components should include: the atomic number (an integer) the name chemical symbol class (strings) a numeric field for the atomic weight a seven-element array of integers for the number of electrons in each shell Normal Credit for Q1-Q3: Create the structures in the main program and initialize all parts of the structures to the assigned values. Print the structures to the user. Extra Credit for Q1-Q3: Your program reads in a String that a user types in at the keyboard, parses it into the items of this structure, initializes a structure on this data, and prints the structure back out to the user formatted cleanly.

Q4) [25 PTS] Create an Arduino program that uses enum to create 6 states and does the following in the states respectively: State 1 Running Forward. Starts a DC motor moving forward (this action should not stop until another State stops it). Trigger State 2. State 2 Wait for Sensor. Waiting for either your IR or Ultrasonic sensor to register an object within 10 centimeters. When sensor detects object Trigger State 3. State 3 Stopping Motor. Stop the DC motor. Trigger State 4. State 4 Time Delay 1. Cause a time delay. Trigger State 5. State 5 Back Away. Turns the DC motor backwards for 5 second. Motors may run at unequal speeds to cause a reverse turn if desired. Trigger State 6. State 6- Time Delay 2. Cause a time delay. Trigger State 1. The program should run through the States as defined in a repeating loo

Thank you in advance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!