Write a program to act as a digital combination lock safe. Create 3 buttons representing 1, 2 and 3. The user clicks on the buttons trying to guess the correct numbers eg (3321). Use a label to keep track of and display code enrered so far. Only once the correct numbers are pressed, the program congratulates the user with a message.
Challenging Numerical Triangles
by CodeChum Admin
You probably have encountered Triangle pattern problems before when you started learning programming. Let’s see how well you do with numbers this time. Try to look at the examples closely and think of an algorithm that replicates the outputs. Go for it!
The first line will contain a message prompt to width of the skyscraper.
The second line will contain a message prompt to height of the skyscraper.
The succeeding lines will contain the skyscraper pattern.
Programming
a. Create class name Employee
b. add the attributes: firstName, LastName, MiddleName, Age, Company,Salary and
IDNumber
c. create a getters and setter for the class
d. add constructors (with and without parameters)
e. add function in your class name it DisplayInfo to display all details of the employee
f. add a function name it SalWithVat, to calculate the salary with 12% tax deduction.
g. Create main class to test your Class
(FOR C #) A class called Company is to be defined as illustrated in the class diagram. It contains two data members: name (of type string) and salary (of type int); and three member functions: getName(), getSalary (), and getEmployee().
Three instances of Company called s1, s2, and s3 shall then be constructed with their respective data members, as shown in the instance diagrams.
Company
-name:string=”Cube”
-salary:int=470000000
+Company()
+Company(n:string)
+Company(n:string, s:int)
+getName():string
+getSalary():int
+getEmployee():int
S3 - Contractor
-name:string=”Jake”
-salary:int=1800
+ getName()
+ getSalary ()
+ getEmployee()
Objects
S1 - Employee
-name:string=”Mark”
-salary:int=1900
+ getName()
+ getSalary ()
+ getEmployee()
S2 - Manager
-name:string=”Kai”
-salary:int=1700
+ getName()
+ getSalary ()
+ getEmployee()
Write a program with structure Inventory(name, colour, size, cost). Then create 3 objects and write code to print information about Inventory with the highest cost. (FOR C #)
5.1. [15 marks] Write a method with the following details:
5.2. [10 marks] Using the method below, write the code statements to call this method ten times with angle values of 0.500, 0.501, 0.502, 0.503, ... 0.509 and printout the values for the angle, resulting sine and cosine in a tabular format. Use a “for” looping structure.
Write a program that repeatedly asks the user to enter two money amounts expressed in pounds. The program should then add the two amounts and display the answer in pounds. The program should then convert the amount in Rupees. (Set conversion rate: 1£=120.33 rupees). Display the answer in Naira. Use a do-while loop that asks the user whether the program should be terminated.
Write a program that does the following for 15 students:
Reads in 3 marks for each student, however, you need to make provision that the user
might be typing invalid values – when an invalid mark is entered, the user should be prompted to re-enter a valid mark. This should happen continuously until you have three valid marks for each student (valid marks are marks between 0 and 100; 0 and 100 included). Your prompt message to the user should indicate which number is being requested
Calculates and displays the highest mark for each student.
Finds and displays the highest mark in the class.
Adapt your code to also read in the name of each student, and add the name to the display
of the highest mark for each student
When displaying the overall highest mark, the name of the relevant student should also be
displayed.
Update your solution to make use of the getMark method. In this updated version, your prompt messages does
not have to indicate which mark is being requested.
3.1. [10 marks] Write a method with the following details:
3.2. [10 marks] Using the method below, write the statements to call the above method with the masses of the earth, moon and the distance between them and display the resulting force.
- Mass of Earth: 5.972E24
- Mass of Moon: 7.348E22
- Distance: 384,400,000 meters
- Answer: 1.99e020N - You should use “E” as a format specifier in your output (like when you use N, F, N2)