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?
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...
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        ...
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:...
A C PROGRAM *Edit/Update I do not need the file loading script, but I am not...
A C PROGRAM *Edit/Update I do not need the file loading script, but I am not against it being included in the answer* I must read off of an excel file (comma separated) to input five different things for a book, all comma separated, there are 360 books in the file. The book title, author, ISBN number, number of pages, and finally the year it was published. Now some of the ISBN or Pg numbers may be missing and will...
Whenever I am attempting to write a simple program on C++ I get an error message...
Whenever I am attempting to write a simple program on C++ I get an error message that reads "cout was not declared in this scope". Literally every time. This has become frustrating because I have even written my code the exact same way as some of my classmates who got theirs to compile and run with no sign of this error at all, and yet min gives this answer. I will leave an example of a code where this error...
I am working on a C++ program, where a user puts in a notation a playing...
I am working on a C++ program, where a user puts in a notation a playing card and the output is the full name of the card.(ex: KH = King of Hearts) I have most of it working but I want to have an error come up when the user puts in the wrong info and then loop back to the original question. Am I setting it up wrong? Pasted below is my code #include<iostream> #include<string> using namespace std; int...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT