A teacher asked Ramesh to draw a Quadrilateral of a specific pattern with only symbol. The length and height should be L. Here L is the number of characters in every line. The height of the
*
quadrilateral is the number of lines it contains.
The slope of the quadrilateral taken as S represents the the number of extra space characters in a line when compared to its next line.
The last line will not have any space characters before the character.
Sample Input
6
9
Sample Output1
******
******
******
******
******
******
1. Write a program that will illustrate the use of a function for computing the square of a number. There must be three other functions aside from main(). The first function must be responsible for inputting the data, the second for computation of squares and the third, for Displaying the result. 10 points
Sample Run:
Input N: 3
The square of 1 is 1
The square of 2 is 4
The square of 3 is 9
2. Modify the program from number 1 by adding a class and apply the "outside of a class function". 20 points
Write a C++ program in Microsoft Visual Studio 2017, 2019 or 2022 that reads employee information from a text file named employees.txt and extract corresponding/matching gross monthly salaries (matched with unique employment number) from a file called salaries.txt.
The programme should then print the employment number, employee surname, employee name, gross monthly salary, monthly tax and net monthly salary for each employee to a file called report.txt in alphabetical order by surname then name.
You are encouraged to write functions and call them in the main function.
For a given number N(0<N<100), little johnny wants to find out the minimum positive integer X divisible by N,where the sum of digits of X is equal to N,and X is not equal to N
Create a program that will String input. Based on the number of inputs,
the USER will decide what shape it is circle,rectangle,square and triangle.
(1 input – circle, 2 inputs – square or rectangle, 3 inputs - triangle).
The program will then display the shape type, details, perimeter and area.
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Circle
Radius:15
Perimeter:94.2
Area:706.5
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Rectangle
Length:24
Width:12
Perimeter:72.0
Area:288.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Square
Side:12
Perimeter:48.0
Area:144.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar 9 15 12
Type:Triangle
Sides:9, 15, 12
Perimeter:36.0
Area:54.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar 9 15 12 8
Invalid input
class:
-TestShape
-Shape
-Circle
-Rectangle
-Square
T-riangle
Write a C++ program to calculate the taxi fare using given conditions Distance in KM Cost in Rs. Per km 0 through 100 12 More than 100 but not more than 500 10 More than 500 but less than 1000 8 1000 or more 5
1) Identify the validation checks that you could use for the following inputs and justify your choice:
If more than a single validation check would be required from your perspective, please indicate which ones and why.
1a) Entering a telephone number.
1b) Entering a student's name.
1c) Entering a part number in this format: XXX999, where X must be any letter from the standard western alphabet (A-Z), and 9 must be replaced with a single digit between 0 and 9.
2) Write an algorithm using pseudocode to check the age and height of a child who wants to go on a fairground ride. The child's age must exceed 7, but below 12, their height must exceed 110 cm, but below 150 cm.
3) Write an algorithm using pseudocode to verify that a password's length exceeds 8 characters, but is shorter than 12 characters. (INCLUSIVE 8-12)
Write a program that prints the first letter of your name using nested loops
Frequency of Numbers
Develop a Python application that will randomly select n integers from 1 to 9 and will count the number of occurrence of the numbers without using the Counter from collections library.
Sample Output:
How many numbers?: 7
[2, 6, 8, 2, 1, 1,6]
2-2
2-6
1-8
2-1
Simple Dice Game
Develop a Python application that will simulate a simple dice game by rolling two dice for the player as his bet followed by another roll of the two dice for the computer.
The mechanics is as follows:
1. If after the roll of the two dice, resulted to same number then the sum will be doubled.
2. If the value of each dice is different, then just get the sum of the values of each dice.
Who gets the highest value wins the game.