Two variables, num_boys and num_girls, hold the number of boys and girls that have registered for an elementary school. The variable "budget" holds the number of dollars that have been allocated to the school for the school year. Write code that prints out the per-student budget (dollar spent per student). If a division by zero error takes place, just print out the word "unavailable". Round the dollar amount to 2 decimal places. Use Python
def findBudget(num_boys, num_girls, budget):
total_num = num_boys + num_girls
if total_num == 0:
print('unavailable')
else:
per_student_budget = budget / total_num
print(round(per_student_budget, 2))
num_boys = int(input('Enter number of boys: ')
num_girls = int(input('Enter number of girls: ')
budget = int(input('Enter budget: ')
findBudget(num_boys, num_girls, budget)
Two variables, num_boys and num_girls, hold the number of boys and girls that have registered for...
Student Created Include private instance variables to store information needed for a ticket. Select the correct data types for each one. Name and ticket type will be strings, the speed and se limit will be integers, the ticket number will be of integer and that the school zone and work zone will be Boolean. A constructor that takes the name, speed, speed limit, school zone and work zone. Another constructor that takes the name, speed and speed limit. The school...
cs55(java) please
Part 1: You are a programming intern at the student transfer counselor's office. Having heard you are taking CS 55, your boss has come to ask for your help with a task. Students often come to ask her whether their GPA is good enough to transfer to some college to study some major and she has to look up the GPA requirements for a school and its majors in a spreadsheet to answer their question. She would like...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....
My Python file will not work below and I am not sure why, please help me debug! ********************************* Instructions for program: You’ll use these functions to put together a program that does the following: Gives the user sentences to type, until they type DONE and then the test is over. Counts the number of seconds from when the user begins to when the test is over. Counts and reports: The total number of words the user typed, and how many...
Exercise #1: Write a C program that contains the following steps (make sure all variables are int). Read carefully each step as they are not only programming steps but also learning topics that explain how functions in C really work. Ask the user for a number between 10 and 99. Write an input validation loop to make sure it is within the prescribed range and ask again if not. Commenting out the existing coding, write the code to divide a...
Please Write the following program in c# You are to write an application which will create a company, add agents (their name, ID, and weekly sales) to that company, and printout the details of all agents in the company. The application will contain three classes: Agent.cs, Company.cs, and CompanyTest.cs (this class is already provided). Flow of the application: The CompanyTest class creates an object of the Company class and reserves space for five agents. At this point if you call...
I have updated my previously posted C++ question to ensure that I have included all of the necessary documentation in order to complete Part 2 - Bank Account of the assigned lab in its entirety. Please note that the lab below is somewhat lengthy, and I do not expect you to answer each question! If coding the full lab is too much to ask, please focus soley on Part 2 of the lab, titled Bank Account and the subsections that...
Using the Random, write a simulation that will "play" the California Super LOTTO. Your program logic will allow the player to: 1) Pick any 6 integer numbers from 1 - 70. Your logic should prevent the player from selecting a value LESS than 1 or greater than 70. The logic should prevent the player from selecting the SAME number (i.e. they cannot have two or more of their selections be the SAME number). 2) Display the players' 6 number selections...
Topic: Business Opportunities for Apple So the company that I have been researching is Apple. We all know that Apple has gotten a lot pricier over the years, and their reputation has kind of taken a hit due to it. Apple also isn't known for being the most charitable or a business that really focuses on helping the community around them. I think a great investment idea for Apple would be on that gives back to the communities around their...
In Java(using BlueJ) Purpose Purpose is to practice using file input and output, and array list of objects. Also, this lab specification tells you only what to do, you now have more responsibility to design how to do it. Problem description You are given a text file called 'Students.txt' that contains information on many students. Your program reads the file, creating many Student objects, all of which will be stored into an array list of Student objects, in the Students...