# Accept string input.
# Display each charter of the string (vertical order)
# Count and display total i charter in the string.
# Accept student name and grade and save it to a dictionary.
# Display the content of the dictionary.
# Display the name and grade of student with the highest and lowest grade.
# Accept integer number and store it to a list until user input is 0.
# Display the content of the list and size of the list.
# Display the highest and lowest numbers in the list and the index number it can be found.
Create a new project, and include in it the class
Create a class "Student" and another class "Teacher", both descendants of
"Person".
The class "Student" will have a public method "GoToClasses", which will
write on screen "I’m going to class."
The class "Teacher" will have a public method "Explain", which will show on
screen "Explanation begins". Also, it will have a private attribute "subject", a
string.
The class Person must have a method "SetAge (int n)" which will indicate
the value of their age (eg, 20 years old).
The student will have a public method "ShowAge" which will write on the
screen "My age is: 20 years old" (or the corresponding number).
You must create another test class called "StudentAndTeacherTest" that will
contain "Main" and:
Create a Person and make it say hello
Create a student, set his age to 21, tell him to Greet and display his age
Create a teacher, 30 years old, ask him to say hello and then explain.
Test the other methods also given in the diagram
Write a program to print all the composite numbers between a and b
Instructions
Given code
#include <iostream>
using namespace std;
int main(void) {
char word[100];
cout << "Enter the word: ";
cin >> word;
int result = hasVowel(word);
if(result == 1) {
cout << "There is a vowel in the word \"" << word << "\"";
} else if(result == 0) {
cout << "There is no vowel in the word \"" << word << "\"";
}
return 0;
}
Ex
Enter·the·word:·CodeChum
There·is·a·vowel·in·the·word·"CodeChum"
Instructions:
Given code
#include <iostream>
using namespace std;
// TODO: Declare the display() function here
int main(void) {
int world[100] = {
1,3,2,4,5,7,6,8,9,11,
100,13,0,14,16,17,3,18,20,10,
12,8,15,14,-5,17,19,18,1,9,5,
10,13,11,14,16,22,0,18,20,3,
99,13,15,14,22,17,19,0,23,2,
12,13,15,22,16,17,56,18,44,99,
2,13,22,14,16,89,19,69,101,34,
12,22,15,14,78,17,69,18,2,33,
4,13,77,7,10,17,19,91,4,22,
12,98,15,14,15,17,19,18,7
};
display(world, 100);
return 0;
}
// TODO: Define the display() function here
Ex
Element·at·index·0:·1
Element·at·index·1:·3
Element·at·index·2:·2
Element·at·index·3:·4
.
.
.
Inst.
Given code
#include <iostream>
using namespace std;
// TODO: Declare findRing()
int main(void) {
int rings[10];
for(int i = 0; i < 10; i++) {
cout << "Enter option #" << i + 1 << ": ";
cin >> rings[i];
}
int wantedRing;
cout << "Enter the ring she wants: ";
cin >> wantedRing;
cout << endl << "Ring " << wantedRing << " is found at option " << findRing(rings, 10, wantedRing) + 1 << "!";
return 0;
}
// TODO: Define findRing()
Ex
Enter option #1: 5
Enter option #2: 3
Enter option #3: 10
Enter option #4: 9
Enter option #5: 13
Enter option #6: 11
Enter option #7: 20
Enter option #8: 25
Enter ring she wants: 25
Ring·25 found·at·option·8
Suppose, your friend is building an automated car called “Besla”. He needs to fix the programming of the car so that it runs at a proper speed. Now, write a python program that takes 2 inputs (distance in meters and time in seconds). The program should then print the velocity in kilometers per hour of that car. Also, it should print whether the car is working properly based on the following chart.
Velocity
Information to be printed
Less than 60 km/h
Too slow. Needs more changes.
Between 60 km/h to 90 km/h
Velocity is okay. The car is ready!
Greater than 90 km/h
Too fast. Only a few changes should suffice.
Hollow pattern using / and _ and | right angle triangle