Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3(18 points)-Write a program Submit lights.c (Create a linked list-0 points without a linked list) Create a program that reads in a light information

image text in transcribed

image text in transcribed

image text in transcribed

Problem 3(18 points)-Write a program Submit lights.c (Create a linked list-0 points without a linked list) Create a program that reads in a light information (a string of lights). Each line m that reads in a file of Christmas in the file represents a single light in the string of lights. nfo is stored in the following format: blue,2,0 where blue is the color, 2 is the brightness of the light and O is the size (0 means small and 1 means big) e program allows users to type in the following three commands: on, off and exit 1. When the user types on, each light should be output to screen (with the first letter of the color representing the light). The brightness dictates how many times the letter should be output to screen see sample run). If the lights are already on (meaning the user had typed on previously and not typed offyet), the program should output Lights are already on. to screen. When the user types off, instead of printing out each letter, the program should print - (see sample run). If the lights are already off, the program should output Lights are already off to screen. Note that the program starts with the lights in the off state If the user types exit, the program exits. 2. 3. You must use the following struct for your nodes (D O NOT MODIFY): typedef struct Nodef char* color; /*color of the light'/ int **details; /"holds the brightness and size*/ struct Node* next; JNode; Step 1: Define the following function: "This function takes the filename and creates a linked list of the string of lights. It returns the head of the linked list Node* light info(char *filename) Step 2: You must define at least one other meaningful function that solves a part of your problem (0 points if you do not do this). Random functions that just print a line do not count. You should mention in comments what this function does and the importance of the parameters and return type. *Hint-You should break down the given problem into smaller problems to figure out what needs a function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions