3 in 1: in less than 12 hours!!!



Question Description

This is an intro to programming course...keep it simple!! And in C

Write a program typemult.c in C that prompts the user for two numbers and asks whether to treat each number as an integer. Then multiply the two numbers, treating each number as an int or double based on the user’s preference. Print the resulting computation, matching the format in the examples below. Note that numbers are comma delimited and that the user can answer the y/n questions with either lower or uppercase letters.

(˜)$ a.out

Enter two numbers to multiply: 2.5,3.5

Is the first number an int (y/n)? n

Is the second number an int (y/n)? N

2.50 * 3.50 = 8.75

(˜)$ a.out

Enter two numbers to multiply: 0.5, 3.5

Is the first number an int (y/n)? n

Is the second number an int (y/n)? Y

0.50 * 3 = 1.50

Write a program energy.c in C that calculates an electricity bill for an electric company that provides a credit for user-generated energy (e.g. from solar panels). Your program will prompt the user for the amount of energy consumed and the amount of energy generated. Note that the user input is / delimited. The bill will be calculated according to a tiered pricing model applied to kilowatt-hours (kWh) consumed and generated. For energy generated, the user is always credited $0.10/kWh. For energy consumed, the first 300 kWh are charged at a rate of $0.15/kWh. Energy consumed beyond 300 kWh is charged at a rate of $0.30/kWh. The energy company likes their calculations to have at least 10 digits of precision and for the price to be returned to the millionth dollar ($0.000001), so choose your variable data types accordingly and format your output as shown below.


How many kWh were consumed/generated? 1/0

Your bill is: $0.150000

(˜)$ a.out

How many kWh were consumed/generated? 100 / 1

Your bill is: $14.900000

Write a program seconds.c in C that prompts the user for a number of seconds and returns the equivalent number of years, days, hours, minutes, and seconds. Your program should correctly respond to inputs that correspond to 0 seconds up to at least 10,000 years. Assume that a year has 365 days,


How many seconds? 40000000

That is 1 year(s), 97 day(s), 23 hour(s), 6 min(s), 40 sec(s)


How many seconds? 0

That is 0 year(s), 0 day(s), 0 min(s), 0 sec(s)

How many seconds? 315360000000

That is 10000 year(s), 0 day(s), 0 hour(s), 0 min(s), 0 sec(s

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Explanation & Answer

xhxvfgnef (136)
New York University

Really helped me to better understand my coursework. Super recommended.