Write a Java program to declare a Class named as Student which contains roll number,
name and course as instance variables and input_Student () and display_Student () as
instance methods. A derived class Exam is created from the class Student . The derived
class contains mark1, mark2, mark3 as instance variables representing the marks of three
subjects and input_Marks () and display_Result () as instance methods. Create an array of
objects of the Exam class and display the result of 5 students
Write a program that computes for the average of 5 numbers using a sequence control structure.
Write a program that asks the user for their name and greets them with their name. (Example “Hello Jade”)
Combine Two Dictionaries Write a program to combine two dictionaries updating values for common keys. Input The first line of input will contain space-separated strings, denoting the keys of first dictionary. The second line of input will contain space-separated integers, denoting the values of first dictionary. The third line of input will contain space-separated strings, denoting the keys of second dictionary. The fourth line of input will contain space-separated integers, denoting the values of second dictionary. Output The output should be a single line containing the list of tuples of dictionary items with all the key-value pairs of two dictionaries sorted in ascending order by key.
Create a program based on the attached output using a for loop.
Output:
Enter hidden number: 50
Set of how many attempts to allow the user to guess: 5
Enter your guess number: 45
Sorry! Your guessed number is lesser than the hidden number.
You have 4 attempts left.
Enter your guess number: 51
Sorry! Your guessed number is greater than the hidden number.
You have 3 attempts left.
Enter your guess number: 10
Sorry! Your guessed number is lesser than the hidden number.
You have 2 attempts left.
Enter your guess number: 17
Sorry! Your guessed number is lesser than the hidden number.
You have 1 attempts left.
Enter your guess number: 49
Sorry! Your guessed number is lesser than the hidden number.
You have 0 attempts left.
Sorry you failed to guess the number please try again later.
Write C++ program to create a base class named Person that includes variables: name and age and then define a derived class named Student that includes four functions setName(), setAge(),setMark(), getName(), getAge() and getMark () to set and return the name of student, age and mark. then define a derived class named Student2 which is derived from both above classes and includes one function named checkAge() to check if the age of students Less than 12 then the student is in primary school and checkMark() to check if mark is less than 50 then student is passes the exam.
Instructions:
Code:
#include <iostream>
using namespace std;
int main() {
char array[100] ="supercalifragilisticexpialidocious";
return 0;
}
Instructions:
Code:
#include <iostream>
using namespace std;
// TODO: Declare the hasConsonant() function here
int hasConsonant(int code)
int main(void) {
char code[100];
cout << "Enter the code: ";
cin >> code;
int result = hasConsonant(code);
if(result == 1) {
cout << "ALERT! There is a consonant in the code!";
} else if(result == 0) {
cout << "There is no consonant in the code. Situation is under control!";
}
return 0;
}
// TODO: Define the hasConsonant() function here
#include <iostream>
using namespace std;
int main(void) {
int winnings[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
};
// TODO: Compute and print the sum of all the winnings here
return 0;
}
Create an enumeration named Month that holds values for the months of the year, starting with
January equal to 1. Write a program that prompts the user for a month integer. Convert the
user’s entry to a Month value, and display it.