#Let us import
#the math library
import cmath
#Create a class and call it calculator
class Calculator:
#define a method a call it trigonometry
def trigonometry(self):
print("Functions Menu")
print("j. asinh")
print("k. acosh")
print("l. atanh")
fun = input("Choose the function :")
if (fun == 'l' or fun == 'k' or fun == 'j'):
a = float(input("Enter the value :"))
dict6 = {'j': cmath.asinh(a), 'k': cmath.acosh(a), 'l': cmath.atanh(a)}
print("The result is : " + str(dict6.get(fun)))
else:
print("Wrong Choice")
# create a new object of Calculator class
my_calc = Calculator()
# Calling object's trigonometry() method
my_calc.trigonometry()
Question:
1. In this program, you are going to create a with getter and setter.
Consider the following relation with set of functional dependencies R(ABCDEF) ABC->D, ABD->E, CD->F, CDF->B, BF->D a) Identify the candidate key(s) in the relation (with proper steps followed). b) Identify which normal form this relation is in and reason for the answer
print ("Functions Menu")
Menu = ["asin","acos","atan","sinh","cosh","tanh"]
Option = ['d','e','f','g','h','i']
for r in range(0,len(Menu)):
print(Option[r],". ",Menu[r])
Flag=1
fun = ' '
while(Flag):
if(fun=='d' or fun=='e' or fun=='f' or fun=='g' or fun=='h' or fun=='i'):
Flag=0
else:
fun = input("Choose the function (d/e/f/g/h/i): ")
a = float(input("Enter the value :"))
dict4 = {'d':math.asin(a), 'e':math.acos(a), 'f':math.atan(a), 'g':math.sinh(a), 'h':math.cosh(a),'i':math.tanh(a)}
print ("The result is : " + Menu[ord(fun)-ord('d')]+"("+str(a)+") = "+str(dict4.get(fun)))
Question:
1. In this program, you are going to create a with getter and setter.
elif op == 7 or op == 8 or op == 9 or op == 10 or op == 11 or op == 12:
a = float(input("Enter the number"))
dict2 = {7: math.fabs(a), 8: math.factorial(a), 9: math.log(
a), 10: math.ceil(a), 11: math.floor(a), 12: math.sqrt(a)}
print("The result is : " + str(dict2.get(op)))
elif op == 13:
print("Functions Menu")
print("a. sin")
print("b. cos")
print("c. tan")
fun = input("Choose the function :")
a = float(input("Enter the angle in radians :"))
dict3 = {'a': math.sin(a), 'b': math.cos(a), 'c': math.tan(a)}
print("The result is : " + str(dict3.get(fun)))
Question:
1. In this program, you are going to create a with getter and setter.
if op == 5:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first % second
print("5. Modulus")
print(result)
if op == 6:
first = int(input("Give the base: "))
second = int(input("Give the power value: "))
result = first ^ second
print("6. Exponentiation")
print(result)
else:
print("Please enter the value from 0 - 6")
op = int(input("Option (1 ... 13): "))
if op == 1 or op == 2 or op == 3 or op == 4 or op == 5 or op == 6:
a = int(input("Enter first number"))
b = int(input("Enter second number"))
dict1 = {1: a+b, 2: a-b, 3: a*b, 4: a/b, 5: a % b, 6: a**b}
print("The result is : " + str(dict1.get(op)))
Question:
1. In this program, you are going to create a with getter and setter.
Write a program to create a queue that permits insertion at any vacant location at the rear end.
Consider the association between a Country class and a Sportsperson class. Country class is defined with a name and other attributes like size, population, capital, etc, and a list of all the Sportspersons that come from it. A Sportsperson class is defined with a name and other attributes like age, height, weight, match scores (int array), number of matches played etc. Provide appropriate getters/setters and toString() method. In a real-world context, we can infer association between country and sports person that hails from that country. A Country object has-a list of Sportsperson objects that are related to it.Note that a sportsperson object can exist with his own attributes and methods, alone without the association with the country object. Similarly, a country object can exist independently without any association to a sportsperson object. In the main method make objects and print list of sportsman of the country, average scores of all sportsperson and the sportsperson who have highest scores in a match.
Make a loop that will accept random decimal/float numbers. When the user inputs 0, the loop will terminate and then output the sum of all negative numbers inputted in 3 decimal places.
if op == 0:
print("Thank you for using our calculator!")
if op == 1:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first + second
print("1. Addition")
print(result)
if op == 2:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first - second
print("2. Subtraction")
print(result)
if op == 3:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first / second
print("3. Multiplication")
print(result)
if op == 4:
first = int(input("Give the first value: "))
second = int(input("Give the second value: "))
result = first * second
print("4. Division")
print(result)
Question:
1. In this program, you are going to create a with getter and setter.
import math
print("MAIN MENU")
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
print("5. Modulus")
print("6. Exponentiation")
print("7. Absolute value")
print("8. Factorial")
print("9. Logarithm")
print("10. Round Up")
print("11. Round Down")
print("12. Square Root")
print("13. Trigonometric Functions")
print("14. Inverse Trigonometric Functions")
print("15. Hyperbolic Functions")
print("16. Inverse Hyperbolic Functions")
print("")
print("NOTE: If you're performing operations in the 1-6 range, don't make the second number zero." )
print()
op = int(input("Enter the operation you want to perform : "))
Question:
1. In this program, you are going to create with getter and setter.