In a class test the teacher announces the marks (negative marking is allowed) of n (n>0) students. A student can achieve maximum 100 marks. Write a python function print_marks(*marks) that takes number of students, marks of students and return the marks and check the marks are valid or not. If valid then it calls the recursive function rec_Sort(*marks) which returns the students marks as a comma-separated string with elements in ascending order. (You can use of built-in function max ()/min() to do this).
Example-1
Example-2
Example-3
Example-4
Example-5
Input:
5
6
56
58
Output:
5, 6, 56, 58
Input:
12
-3
45
37
90
Output:
-3, 0, 12, 37, 45, 90
Input:
56
96
100
101
Output:
Invalid Input
Input:
56
196
20
10
Output:
Invalid Input
Input:
50
40
10
Output:
0, 10, 40, 50
Develop a Java application that will determine the gross pay for each of
three employees. The company pays straight time for the first 40 hours
worked by each employee and time and a half for all hours worked in
excess of 40 hours. You are given a list of the employees of the company,
the number of hours each employee worked last week and the hourly rate
of each employee. Your program should input this information for each
employee and should determine and display the employee’s gross pay.
When will the ‘break’ and ‘continue’ statements be used in programme? Mention the scenario and write the programme to demonstrate this.
Input numbers from the user and find the sum of all those input numbers until the user inputs zero. In other means, the loop should end when the user enters 0. Finally, display the sum of all those numbers entered by the user.
Write a program to take a String as input then display the word in one column and its position on the String in another column.
Enter a String
Coronavirus was the Worst pandemic
Coronavirus \t 1
was \t 2
the \t 3
Worst \t 4
pandemic \t 5
Write a program to take a String as input then display the first letter of each word.
Example:
Enter a String
JAPAN is Best
JiB
Description:
A palindrome is a string, which when read in both forward and backward ways is the same.
Example: lol, pop, radar, madam, etc.
To check if a string is a palindrome or not, a string needs to be compared with the reverse of
itself.
Demonstrate these two functions in a program that performs the following steps:
1. The user is asked to enter a string.
2. The program displays the following menu:
A) Display the reverse of the string
B) Check the string is palindrome or not
C) Exit the program
3. The program performs the operation selected by the user and repeats until the user
selects E to exit the program.
Output:
Enter a string : madam
Please enter a choice according to menu:
A) Display the reverse of the string
B) Check the string is palindrome or not
C) Exit the program
Please enter choice: A
The reverse of the string is : madam
Please enter choice: B
Madam is palindrome
Please enter choice: E
Terminate the program
How to execute this using vector?
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
const int MAXCNT = 10; // Constant
float arr[MAXCNT], x; // Array, temp. variable
float array2[MAXCNT];
int i, cnt; // Index, quantity
cout << "Enter up to 10 numbers \n"
<< "(Quit with a letter):" << endl;
for (i = 0; i < MAXCNT && cin >> x; ++i)
arr[i] = x;
cnt = i;
// copying elements of an array to another
// array2 = arr
for (int index = 0; index < cnt; index++)
array2[index] = arr[index];
cout << "The given numbers:\n" << endl;
for (i = 0; i < cnt; ++i)
cout << setw(10) << arr[i];
cout << endl;
return 0;
}
Objective:
Write a program that accepts a string as an input and perform following –
Write a function that accepts a string as an argument and display the reverse of that string and
return that string.
Write another function that accepts a string as its argument and check whether the string is
palindrome or not.
Description:
A palindrome is a string, which when read in both forward and backward ways is the same.
Example: lol, pop, radar, madam, etc.
To check if a string is a palindrome or not, a string needs to be compared with the reverse of
itself.
Demonstrate these two functions in a program that performs the following steps:
1. The user is asked to enter a string.
2. The program displays the following menu:
A) Display the reverse of the string
B) Check the string is palindrome or not
C) Exit the program
3. The program performs the operation selected by the user and repeats until the user
selects E to exit the program.
Construct a class named student consisting of a student identification number, list of five grades, and an integer representing the total value of grades entered. The constructor for this class should initialize all student data members to zero. Included in the class the functions/ methods for:
1. Constructor and a Destructor.
2. Create an assessor method to enter a student number
3. Create a method to enter a single test grade (used loop for entering 5 grades)
4. Create a mutator method – to computer an average grade
5. Create a method to display the student number and average grade.