An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number, because 6 = 1 + 2 + 3. Write a method perfect that determines whether parameter number is a perfect number. Use this method in an application that determines and displays all the perfect numbers between 1 and 1000. Display the factors of each perfect number to confirm that the number is indeed perfect.
Write a method multiple() that determines, for a pair of integers, whether the second integer is a multiple of the first. The method should take two integer arguments and return true if the second is a multiple of the first and false otherwise. [Hint: Use the remainder operator “Modulo”.] Incorporate this method into an application main() that inputs a series of pairs of integers (one pair at a time) and determines whether the second value in each pair is a multiple of the first.
A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hours at a time.
Write an application that calculates and displays the parking charges for each customer who parked in the garage yesterday. You should enter the hours parked for each customer.
The program should display the charge for the current customer and should calculate and display the running total of yesterday’s receipts. The program should use the method calculateCharges() to determine the charge for each customer.
mini project of C++ Doctor Appointment System using (fuctions, arrays,structure)
Doctor's appointment - simulates the appointment system of any hospital.
Admin:
Add a Doctor Information
Delete or Modify a Doctor Information
Confirm an appointment
Calculate Charges
User:
Book an appointment
Search a Doctor by their name or specialization
Get invoices
Write a function NumRepeats(num1,num2,num3) that takes 3 integers as arguments, and returns the number of items that are repeated.
Example:
NumRepeats( 5, 9, 4) will return 0
NumRepeats( 5, 9, 5) will return 1
NumRepeats( 5, 5, 5) will return 2
Write a method whatSeason(month, day) that prints out the season according to the month and day.
The month is a integer that is one of the months - like 1 to 12.
The day is an integer that is a legal day of the month - like 1 to 31.
You may assume that the month and day are “legal” values.
Winter is from 12/21 to 3/19 Spring is from 3/20 to 6/20 Summer is from 6/21 to 9/22 Fall is from 9/23 to 12/20
It should print out one of these four messages:
It is spring.
It is summer.
It is fall.
It is winter.size1 and size2 are the sizes of two files, and space is the amount of available space on a flash drive. Write a function that takes these integer numbers as arguments and figures out the largest combination of files that fits on a flash drive. The method should return 3 if both files fit together, the file number (1 or 2) corresponding to the longest file that fits by itself (1 if the files are the same size), or 0 if neither file fits on the flash drive.
Your function must have only one return statement
Write a function called recommend(temp, forecast) that prints out a recommendation about what to wear and bring based on the weather. temp is an integer number that represents the temperature in degrees. forecast is a string which describes the weather forecast for the day.
When the temperature is under 72 degrees, a jacket should be worn.
If the forecast is “showers”, “rain”, or “snow”, an umbrella should be brought.
Your output should be one of these sentences based on the forecast & temperature.
Based on the weather forecast, you should bring a jacket and an umbrella
Based on the weather forecast, you should bring an umbrella
Based on the weather forecast, you should bring a jacket
Weather is great! Have a nice day!def winnerRPS(me, you):
if(me == you):
return(0)
if(me == "rock"):
if(you == "scissor"):
return(1)
else:
return(-1)
if(me == "paper"):
if(you == "rock"):
return (1)
else:
return(-1)
if(me == "scissor"):
if(you == "paper"):
return(1)
else:
return(-1)
def main():
print(winnerRPS("rock", "paper"))
print(winnerRPS("rock", "rock"))
print(winnerRPS("paper", "scissor"))
print(winnerRPS( "scissor", "paper" ) # now add your own to test it more...
if __name__ == "__main__":
main()
Can't figure out what should go in : if __name__ == "__main__":
main()
About assignment of c++
In put
Each Student name
Each Student father name
Each Student id number
Number of students
Number of subject
Each subject
Each subject credit hours
Each subject grade
Then calculate GPA
Out put
Student name
Student father name
Student Id number
GPA
If grade is F the student is fail.
The program must be display if you ask one student information.