Question

In: Computer Science

Program this scenario in C. Scenario: I am in highschool and i want to go see...

Program this scenario in C.

Scenario:

I am in highschool and i want to go see a movie. I have a certain amount of money to spend. Matinees are $8.50 and Evening Showings are $11.75. There is a G, PG, PG-13, and R movie at the theater. Ask the highschooler their age and how much money they have. With this info determine what showtime they can go see and what movies they are not allowed to see. Make it fun by assigning movie titles instead of ratings.

Solutions

Expert Solution

#include <stdio.h>

int main(void) {
  
  
   int age;
   float money;
   printf("Enter your age : ");
   scanf("%d",&age);
   printf("\nHow much money do you have ? : ");
   scanf("%f",&money);
  
   if(age >=14 && age <=18)
   printf("\nYou can watch G, PG, PG-13 movies");
  
   if(money >= 11.75)
   printf("\nYou can watch evening show");
   else if(money >= 8.50 && money <11.75)
   printf("\nYou can watch Matinee show");
   else
   printf("You have insufficient money");
  
  

  
   return 0;
}

Output:

Enter your age : 15
How much money do you have ? : 9.0
You can watch G, PG, PG-13 movies
You can watch Matinee show

Do ask if any doubt. Please upvote.


Related Solutions

Consider this scenario: I am the owner of a burger store and I want to expand...
Consider this scenario: I am the owner of a burger store and I want to expand my business. I need to prepare a human resource management plan to show an overview of my human resource management system. This plan is the bigger picture that shows the synergy between all my human resource management functions. I need to do to an overview on how important my employees (chef, waiters, restaurant manager) are in making or breaking my business expansion. Please provide...
Consider this scenario: I am the owner of a burger store. I want to expand my...
Consider this scenario: I am the owner of a burger store. I want to expand my business. I have to recruit a waiter and an assistant manager. My question is: What is the objective of my training plan? Explain the role of training in my business expansion? Please provide justifications for your answer. Note: If you are not sure how to fulfill the requirements needed, please do not attempt the question. Your help is very much appreciated. Thank you.
I am writing a shell program in C++, to run this program I would run it...
I am writing a shell program in C++, to run this program I would run it in terminal like the following: ./a.out "command1" "command2" using the execv function how to execute command 1 and 2 if they are stored in argv[1] and argv[2] of the main function?
I am writing a jave program. I have seen the topic before but I want to...
I am writing a jave program. I have seen the topic before but I want to do it this way. And I got an error says: BonusAndDayOffRew.java:14: error: variable monthlySales might not have been initialized getSales(monthlySales); ^ Here is the description:A retail company assigns a $5000 store bonus if monthly sales are $100,000 or more. Additionally, if their sales exceed 125% or more of their monthly goal of $90,000, then all employees will receive a message stating that they will...
What am i doing wrong. I want for the program to run through then when it...
What am i doing wrong. I want for the program to run through then when it gets to "do you want to play again?enter yes or no" if they choose yes I want it to run again if they choose no then end. def play(): print("Welcome to the Game of Life!") print("A. Banker") print("B. Carpenter") print("C. Farmer") user_input = input("What is your occupation? ").upper() if user_input == "A": money = 100 elif user_input == "B": money = 70 elif user_input...
I am trying to create a makefile for the following program in Unix. The C++ program...
I am trying to create a makefile for the following program in Unix. The C++ program I am trying to run is presented here. I was wondering if you could help me create a makefile for the following C++ file in Unix and show screenshots of the process? I am doing this all in blue on putty and not in Ubuntu, so i don't have the luxury of viewing the files on my computer, or I don't know how to...
Can you write this program, but in python, I just wanna see what am I doing...
Can you write this program, but in python, I just wanna see what am I doing wrong. thank you Instructions: The Gas-N-Clean Service Station sells gasoline and has a car wash. Fees for the car wash are $1.25 with a gasoline purchase of $10.00 or more and $3.00 otherwise. Three kinds of gasoline are available: regular at $2.89, plus at $3.09, and super at $3.39 per gallon. User Request: Write a program that prints a statement for a customer. Analysis:...
I am having a trouble with a python program. I am to create a program that...
I am having a trouble with a python program. I am to create a program that calculates the estimated hours and mintutes. Here is my code. #!/usr/bin/env python3 #Arrival Date/Time Estimator # # from datetime import datetime import locale mph = 0 miles = 0 def get_departure_time():     while True:         date_str = input("Estimated time of departure (HH:MM AM/PM): ")         try:             depart_time = datetime.strptime(date_str, "%H:%M %p")         except ValueError:             print("Invalid date format. Try again.")             continue        ...
New to C programming and I am stuck. The program will print "no input" if no...
New to C programming and I am stuck. The program will print "no input" if no input is given. If a command line argument is given the program will print "input:" followed by the user input. Below is the code I put together to do as desired but I get errors. What do I need to fix to get my code to compile correctly? #include <stdio.h> #include <stdlib.h> int main () { char input; scanf("%c", &input); if (input == NULL)...
I WANT THIS CODE TO BE SIMPLE BECAUSE I AM NEW TO CODING AND I WANT...
I WANT THIS CODE TO BE SIMPLE BECAUSE I AM NEW TO CODING AND I WANT TO KNOW THE DETAILS! straight C Program. write a quiz game where a number of questions are asked and the user will win each time he answers right. and he loses each time he answers wrong. the type of questions asked can be about sports or anything else. You can put 5 quiz questions. It should only include the following: #include <stdio.h> and #include...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT