Write a program in C# that generates (clean) insults at random. The program must have a function that takes in the name of a person and prints out an insult directed to them. Further, the program should ask if the person has had enough insults and continue until they type “yes”. Your code must have at least five different kinds of insults. No profanity. Please use a function method for the random insult and do not use an array. The function method will be used in the main method when the user gets prompted for the name.
using System;
public class Program
{
public static void print(string name, string insult1,
string insult2, string insult3, string insult4, string insult5)
{
Random random = new Random();
int n = random.Next();
if (n % 5 == 1) {
Console.WriteLine(insult1);
} else if(n % 5 == 2) {
Console.WriteLine(insult2);
} else if(n % 5 == 3) {
Console.WriteLine(insult3);
} else if(n % 5 == 4) {
Console.WriteLine(insult4);
} else {
Console.WriteLine(insult5);
}
}
public static void Main()
{
string insult1 = "insult1";
string insult2 = "insult2";
string insult3 = "insult3";
string insult4 = "insult4";
string insult5 = "insult5";
while(true) {
string name =
Console.ReadLine();
print(name,
insult1, insult2, insult3, insult4, insult5);
Console.WriteLine("Did the person have enough insults");
string ans =
Console.ReadLine();
if
(ans.Equals("yes"))
break;
}
}
}
comment down for any queries
please give a thumbs up
Write a program in C# that generates (clean) insults at random. The program must have a...
Write pseudocode and the write the source code in C++,
thanks!
Program 0: Insulted yet? Most people get harassed by telemarketers, so for your warmup question, you're going to design (pseudocode) and write (source code) a program that generates (clean) insults at random. The program must have a function that takes in the name of a person and prints out an insult directed to them. Further, the program should ask if the person has had enough insults and continue until...
Please do in Java source Insulted yet? Most people get harassed by telemarketers, so for your warmup question, you’re going to design (pseudocode) and write (source code) a program that generates (clean) insults at random. The program must have a function that takes in the name of a person and prints out an insult directed to them. Further, the program should ask if the person has had enough insults and continue until they type “yes”. Your code must have at...
MUST BE PROCEDURAL CODE, DO NOT USE GLOBAL VARIABLES. Write a program in C++that generates random words from a training set as explained in the lectures on graphs. Do not hard-code the training set! Read it from a file. A suggested format for the input file: 6 a e m r s t 10 ate eat mate meet rate seat stream tame team tear Here are some suggestions for constants, array declarations, and helper functions #include <iostream> #include <fstream> #include...
C++ Write a program that generates and prints 24 random values using an array and the rand () function. Implement an algorithm to find the maximum and a minimum number of random numbers generated. Use the header "#include <ctime>", "#include <cstdlib>" in addition to the usual header: "#include <iostream>"
Write a C or C++ program a pseudo C program (based on chapter 2 in the book) and then use these programs to develop a MIPS program that gets an integer input from the user, and based on the input returns the minimal or maximal value stored in a static initialized array. The following are detailed instructions: 1) The program generates a static initialized array with 10 integers (using the .word directive). 2) The program prompts the user to enter...
Write a program that generates a sequence of 20 random die tosses in an ArrayList and that prints the die values, marking only the longest run, like this: 1 2 5 5 3 1 2 4 3 (2 2 2 2) 3 6 5 5 6 3 1 If there is more than one run of maximum length, mark the first one. Must use ArrayList, not an array!
C# Write a program that takes a list of information and grades of the students of a class and perform some processing. Take the following steps to write the program. The program must give the user two options such as a menu. At the beginning of the program must ask the following from the user: Which task you want to do (choose an option between 1-2), 1- Entering new information 2- Searching a student If the user types something rather...
Write a C++ program that generates a random number from 0 to 9. It will then prompt the user to guess the random number it generated. Your program stops if the user guesses the right number. (Use the cout function to display the random number the computer generates so that you can determine if your code actually works). SAMPLE OUTPUT Random number = 8 Guess a number in the range [0,9]: 1 Too low Guess a number in the range...
Homework 1 - Simple Array Handling Write a working C++ program to ask the user for a set of grades which are to be stored in an array in increasing sequence. The user must first provide the number which represents the count of all grades to be provided. For example, if there will be 10 grades, the user is first prompted to provide the number 10. Subsequently, each grade is provided, one at a time. Allow for a maximum of...
Write a JAVASCRIPT program that will help an elementary school student learn multiplication. Use the Random method to produce two positive one-digit integers. The program should then prompt the user with a question using random numbers, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it is correct, display the message "Very good!" and ask whether the student wants to continue if so then ask another multiplication...