- Person class
Create a Person class that implements the above methods. A person should have a last name and an address. It should also be possible to display this information using the toString() method.
- Student class
Create a Student class that implements the above methods. Student must have a program, a year and fee. It should also be possible to display this information using the toString() method.
- Staff class
Create a Staff class that implements the above methods. Staff must have a school name (School) and a salary (pay). It should also be possible to display this information using the toString() method.
Define a Car class with the following attributes: Id, Brand, Speed, Power.
Define a constructor allowing the attributes of a car object to be initialized
by values passed as parameters. Knowing that Id must be auto-increment.
Define the accessors to the different attributes of the class.
Define the toString () method to display the information of a car.
Write a Java program to test the Car class by creating an array of cars.
Display all their attributes, and give the total number of the cars
Convert the above algorithm to a Python program to output the desired results.
1.Start
2.Initialize Sum , Count to 1 ( Sum = 1 , Count = 1 )
3.Enter a temp
4.Add Temp to sum. ( Sum = Temp + Sum )
5.Increase Counter by 1 ( Count = Count + 1)
6.Repeat step 3 through 5 , Ten times
7.Calculat average temp in Fahrenheit (Average temp = (( sum * 9 / 5 ) + 32 ) / 10 )
8.If t Average temp is more than or equal to 97 and Average temp is less than or equal to 99 then Display “Your body temperature is normal”
9.Else Average temp is more than to 100.4 then Display “You have a fever caused by an infection or illness”
10.End.
1.Start
2.Initialize Sum , Count to 1 ( Sum = 1 , Count = 1 )
3.Enter a temp
4.Add Temp to sum. ( Sum = Temp + Sum )
5.Increase Counter by 1 ( Count = Count + 1)
6.Repeat step 3 through 5 , Ten times
7.Calculat average temp in Fahrenheit (Average temp = (( sum * 9 / 5 ) + 32 ) / 10 )
8.If t Average temp is more than or equal to 97 and Average temp is less than or equal to 99 then Display “Your body temperature is normal”
9.Else Average temp is more than to 100.4 then Display “You have a fever caused by an infection or illness”
10.End.
A bank is providing loan to its customers. Customers will return back loan with installments without any INTEREST but penalty charges are needed to be paid.
Fine Rs. 100 per day will be charged if amount is paid after due date and 5% penalty will be charged on Due amount if pay less amount. write c++ code using arrays. only math.h lib can be used if needed.
part 2:
can this c++ code be done using no library as we are not allowed to use any. We can only use array which is compulsory for this question and along side arrays we are allowed to use switch else if while for loops only.and also we have to take loan amount, no of installment, amount of each installment date, installment amounts from user to calculate penalty and show the data in tabular form.
1.Start
2.Initialize Sum , Count to 1 ( Sum = 1 , Count = 1 )
3.Enter a temp
4.Add Temp to sum. ( Sum = Temp + Sum )
5.Increase Counter by 1 ( Count = Count + 1)
6.Repeat step 3 through 5 , Ten times
7.Calculat average temp in Fahrenheit (Average temp = (( sum * 9 / 5 ) + 32 ) / 10 )
8.If t Average temp is more than or equal to 97 and Average temp is less than or equal to 99 then Display “Your body temperature is normal”
9.Else Average temp is more than to 100.4 then Display “You have a fever caused by an infection or illness”
10.End.
Students NamesInt1 MarksInt2 MarksInt3 MarksFinal ICAStatusScore of 100Mpho Tau5010090Neo Kou1001030Dee Maps203525Dkay Reed1004585Thabo Koloi506530Thato Khahloe10010090
Use the “IF” function to assign students a Status based on the following; Proceed (if final ICA is 50 or more), Supplement (if final ICA is between 30 and 49) or Retake (if final ICA is 29 or less).
Given the length and breadth of a rectangle, write a program to find whether the area
of the rectangle is greater than its perimeter. For example, the area of the rectangle
with length = 5 and breadth = 4 is greater than its perimete
Write conditional expressions for
If a < 10 b =20, else b = 30
Print 'Morning' if time < 12, otherwise print 'Afternoon'
Write a nested loop program to get the following output:
Traversing through list using nested loop
Outer Loop 10
Inner Loop A
Inner Loop B
Inner Loop C
Outer Loop 20
Inner Loop A
Inner Loop B
Inner Loop C
Outer Loop 30
Inner Loop A
Inner Loop B
Inner Loop C