Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the code in c , to create a type called Appliance. Appliance should be a structure consisting of a string of length 5 0
Write the code in c to create a type called Appliance. Appliance should be a structure consisting of a string of length called name, an int called powerrating, and a double called hoursper day.
For example, it should be possible to use your type as follows:
Appliance toaster toaster;
Then, under the type definition, write a function called calculatecost that takes an Appliance and a cost for the power in cents per kWh This function should calculate the daily cost using the formula
dailycostpowerratinghoursperdaycost
With the toaster numbers above,
printfd calculatecosttoaster;
should display
Please note: you should not write a main function. Assume that all necessary #include statements, the main function, and the printf statements to display output have all been implemented these will be added under the code that you write. You should write only the structure definition and the calculatecost function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started