Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

)Write a program that generates a random number between 1 and 10 inclusive. Ask a user to guess the random number, then display a message indicating whether the user’s guess was too high, too low, or correct.

• The message “Sorry – your guess was too low!” should be displayed if the number entered by the user is lower than the random number generated

• The message “Sorry – your guess was too high!” should be displayed if the number entered by the user is higher than the random number generated.

• The message “Congratulations – your guess is correct!” should be displayed if the number entered by the user matched the random number generated.


The user is given up to 3 attempts to guess.

• If the user did not successfully guess the random number after 3 attempts, display: “The random number was X” (X is the random number).

• If the user successfully guesses the random number within 3 attempts, display: “You guessed the number on attempt number X” (X is the attempt count).


)Write a program that generates a random number between 1 and 10 inclusive. Ask a user to guess the random number, then display a message indicating whether the user’s guess was too high, too low, or correct.

• The message “Sorry – your guess was too low!” should be displayed if the number entered by the user is lower than the random number generated

• The message “Sorry – your guess was too high!” should be displayed if the number entered by the user is higher than the random number generated.

• The message “Congratulations – your guess is correct!” should be displayed if the number entered by the user matched the random number generated.


Given months and temperature (in ºC) data as shown in the code snippet below:

string[] month = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",

"Aug", "Sep", "Oct", "Nov", "Dec" };

double[] temperature = { 3.0, 5.6, 9.7, 13.8, 19.0, 24.5, 26.0, 25.0,

21.3, 14.6, 7.6, 2.8 };


a) Determine the temperature classification based on the table given.

Temperature Classification Temperature Range

Freezing < 0 ºC

Very Cold 0 ºC – 5.9 ºC

Cold 6 ºC – 9.9 ºC

Cool 10 ºC – 13.9 ºC

Mild 14 ºC – 17.9 ºC

Moderate 18 ºC – 22.9 ºC

Warm 23 ºC – 26.9 ºC

Very Warm 27 ºC – 29.9 ºC

Hot > 30 ºC


b) Determine the minimum and maximum value from the array of temperature

given. Subsequently, compute the average mark (rounded to 2 decimal

places).





Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False.  

Implement has_duplicates by creating a histogram using the histogram function above. Do not use any of the implementations of has_duplicates that are given in your textbook. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates. 

Write a loop over the strings in the provided test_dups list. Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following. 

aaa has duplicates

abc has no duplicates 

Print a line like one of the above for each of the strings in test_dups. 


Account numbers sometimes contain a check digit that is the result of a mathematical calculation. It is used to help ascertain whether the number is a valid one. Develop a simple C# application that asks a user to enter a four-digit account number and determines whether it is a valid number. The number is valid if the fourth digit is the remainder when the number represented by the first three digits of the four-digit number is divided by 7. For example, 7770 is valid, because 0 is the remainder when 777 is divided by 7.


Write a program to find the total and average of a set of numbers entered by a

user. The following provides additional details on how the program should work:

• The program should prompt the user how many numbers they want o

process.

• Once user input is obtained, user will be asked to enter the numbers

used to calculate the total and average repeatedly. (Data validation

must be performed to ensure that the user input is between 1 to 100

inclusive)

• Finally, the total and average calculated will be displayed to the user.


Date Format - 2

Given seconds as input, write a program to print in D days H hours M minutes S seconds.

Input


The input will be a single line containing an integer.

Output


The output should be a single line containing the D Days H Hours M Minutes S Seconds format. Print only the non-zero values.

Explanation


For example, if the given seconds are 200. As 200 seconds is equal to 3 minutes and 20 seconds, and days, hours are zero, so ignore the days and hours. So the output should be "3 Minutes 20 Seconds"

Sample Input 1

200

Sample Output 1

3 Minutes 20 Seconds


Sample Input 2

86400

Sample Output 2

1 Days


Create a “Boss” class that inherits from the “Armed Enemy” class. Implement an additional

armor level field for the “Boss” class and provide suitable getter and setter methods. Create a

“Boss” Object in the main function to test the functionality of your “Boss” class.



Task 3:

Consider a class Computer having Two fields (i.e. companyName, price) and A single function named show() A class named Desktop inherits Computer class and adds fields representing color, monitor size, and processor type and Override function named show() to display values of its all attributes A class named Laptop inherits Computer class and adds fields representing color, size, weight, and processor type and Override function named show() to display values of its all attributes In Main() instantiate objects of derived classes to access respective show() functions to see the polymorphic behavior.


Task 2:(Inheritance and Polymorphism)

We want to calculate the total marks of each student of a class in Physics, Chemistry and

Mathematics and the average marks of the class. The number of students in the class are entered by the user. Create a class named Marks with data members for roll number, name and marks. Create three other classes inheriting the Marks class, namely Physics, Chemistry and Mathematics, which are used to define marks in individual subject of each student. Roll number of each student will be generated automatically.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS