36. Which of the following will seed the random number generator with a different value each time the program is run? a. seed(time(0)); b. seed(RAND MAX); c. srand(time(0)): d. srand(RAND_MAX); 37. Assume that class Rectangle has two members, length and width. The below code is intended to set length=10.0 and width-5.0. Rectangle r={10.0,5.0}: Will a. will work. b. Will not work. c. Only work if length and width are private. d. Only work if length and width are public. 38. A linear search will work on data that is a. sorted b. unsorted C. both a and b d. numeric
Q: 19. What will the following code print out: if x < 2 : print ('Small) elif x < 1 : print ('Medium)…
A: ANSWER:-
Q: public class ReversedDigit { public static void main(String[] args) { Scanner scan =…
A: The do-while loop is a variant of the while loop.
Q: File Factorials.java contains a program that calls the factorial method of the MathUtils class to…
A: Factorial of a number Factorial of a number is define as the product of all the numbers starting…
Q: The following program includes fictional sets of the top 10 male and female baby names for the…
A: Given set of male and female names are {'Michael', 'Henry', 'Jayden', 'Bailey', 'Lucas', 'Chuck',…
Q: 6.17 LAB: Max magnitude Write a method maxMagnitude() with two integer input parameters that…
A: Java is programming language that can be used for the creation of the applications for the different…
Q: Imagine a publishing company that markets both books and audio-cassette versions of its works.…
A: As no programming language is mentioned, it is solved using basic C++
Q: A. Using the random method of the Math class, create a random floating-point number between…
A: First import the random package Second create random object
Q: X609: Magic Date A magic date is one when written in the following format, the month times the date…
A: Create as MagicDate class and main method. Inside main method take month, day and year of a date as…
Q: What will be displayed after the following code snippet is executed ? int] a = new int[O { 8, 3, 4,…
A: Above code snippet does following things Initialize integer array a ={8,3, 4, -2, 6 } and declare…
Q: /** * Simulate helping a student */ #include #include #include #include "ta.h" void…
A: The error in the code is corrected and written in the following step. This code is of C++. C++…
Q: Write a program that prompts for an integer (that a side length) and displays, using asterisks, a…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Car + MAX_Weight: double counter: int id: int weight: double - mileage: long owner : Person + Car (…
A: In this question first we will create the UML diagram. For that we have used the software STAR UML.…
Q: Q1) (40 points) Write a method that generates and outputs a random permutation of numbers between 1…
A: Code
Q: Question 6 What will the output be for the following code? include using namespace std; class…
A: Given:
Q: this is my code and the question need to be continued. #include using namespace std; class…
A: As per the given requirement Implemented the addMember, removeMember and display member functions…
Q: 1. Write a program that separately prompts the user for a first name and last name and outputs a…
A: As per our guidelines we are supposed to answer?️ only one question. Kindly repost other questions…
Q: Complete the following code. Make sure to complete the code in such a way that doesn't invalidate…
A: The answer is given below.
Q: You are working for a financial advisor who creates portfolios of financial securities for his…
A: C++ is an objective oriented programming language and same has been used to solve the above…
Q: What will the output be for the following code? tinclude using namespace std; class Person public:…
A: Given C++ code #include <iostream>using namespace std;class Person{ public:…
Q: The following declaration, program, and program segment has errors. Locate as many as you can. class…
A: This program consists of seven errors. The following statements contain errors: The first error…
Q: #include using namespace std; class Player { private: int id; static int next_id; public:…
A: Coded using C++.
Q: Carefully understand the code given bellow. Analyze the code and suggest any corrections needed with…
A: Correct C++ code: #include <iostream>using namespace std; class Student { //data members…
Q: Complete the following code. Make sure to complete the code in such a way that doesn't invalidate…
A: The answer is given below:-
Q: Use the following code without changing anything to to produce the output that is attached. public…
A: Solution: Given, public class GradeBookTest { public static void main( String[] args ) {…
Q: How do I display the highest GPA between three students? The code is below: #include #include…
A: #include <iostream>#include <string> using namespace std; //declare Student Class class…
Q: 2. Write a program with a user interface which allows the user to enter 2 integers. It should then…
A: Program to perform addition, subtraction, multiplication and division on two input numbers in Python
Q: 1.16 LAB: Input: Mad Lib Mad Libs are activities that have a person provide various words, which are…
A: According to the question Coding, language is not mentioned to write a particular programming…
Q: Assign courseStudent's name with Smith, age with 20, and ID with 9999. Use the printAll() member…
A: To assign courseStudent's name with Smith, age with 20, and ID with 9999, you need to initialize…
Q: What would be the result of the following set of code? int count = 1; while (count <= 10) {…
A: The given Code is 1. int count = 1;2. while (count <= 10)3. {4. cout…
Q: Q3:Ten students in a class write a test. The marks are out of 10. All the marks are entered in a…
A: Note: Answering the first question i.e. Q3. as per the guidelines Input to the Code : Marks for ten…
Q: struct ( char a; int b; char e; } one; struct { char a; char c; int b; } two; Which of the following…
A: They both take up the same amount of memory.
Q: int t = 7; int s = 17; if (t > 6) { s t= 5; } else { s -= 2; } D-2 D 5 O 22 D 17
A: 1) the expression should include 98 and 101, but anything lower or higher should sound an alarm.…
Q: What am I doing wrong on this and how can I fix it? #include #include using namespace std;…
A: In this question we have given a C++ code. We have to correct the code then we will paste the output…
Q: #include using namespace std; class Player { private: int id; static int next_id; public: int…
A: The output of the given program is:- 1 2 3
Q: Use a class named Character with string variables fullname, weapon, vision, and integer variables…
A: Given :
Q: 1. Create a calculator using a class, the class must accept two values as parameters/arguments, then…
A: Here is the code for question 1.
Q: 7 public static void start() 8 Scanner input = new Scanner(System.in); 10 11 String [Unumbers= {"2",…
A: Corrections: Import required libraries. Below libraries are required in the program to use Scanner…
Q: C++ Help me fix my code please! I'm missing something and can't figure it out. Code and error…
A: In this question you have to calculate monthly salary based on increment. and increment is only…
Q: 5. Add a firstname parameter of type String to myMethod, and output "Azeneth Garcia". static void…
A: Function Parameter: The function parameter includes the data type and the variable name. The data…
Q: Find the errors in this code: double gpa[] = {2.2, 3.8, 4.0, 3.6, 1.7, 2.8}; int countSuper = 0;…
A: Find the errors in this code: double gpa[] = {2.2, 3.8, 4.0, 3.6, 1.7, 2.8}; int countSuper = 0; //…
Q: include using namespace std; class Player { private: int id; static int next_id; public: int…
A: Here have to determine about c++ code and output.
Q: Write a method checkCharacter() which has 2 parameters: A String, and a specified index (an int).…
A: Hello student. Greetings from my side. Hope you are doing great. I will try my best to answer your…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: I give the code in Python along with output and code screenshot
Q: A Java main method uses the parameter (String[ ] variable) so that a user can run the program and…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: cs101: Lab #5 Using Classes and Objects Part II 1. Write a program that computes the area of each…
A: Given:
Q: Medium resistance: This class includes all resistances of values between 10 Q and 100 k Q. Most of…
A: Below is the complete solution and explanation to the given question in detail.
Q: I already have the code for the assignment below, but the code has an error in the driver class.…
A: Here I have created a class named U10E03R. Inside this class, I have created the method named…
Q: Create a class called Mather with a main method. Create an int width = 7. Create an int height = 6.…
A: Below program will make use of 4 variables for strings for use of output. Area is driven multiplying…
Q: Fill the blank to get a random value between 20 and 28 srand(time(0)); int i - 20 + rand() % 5;…
A: Here, we are going to select correct expression for integer j which will print a random number…
Q: Unfair hurdles are hurdles which are either too high, or way too close together. Create a function…
A: Since the programming language is not mentioned , I have done the code using JavaScript.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- How do I display the highest GPA between three students? The code is below: #include <iostream>#include <string> using namespace std; //declare Student Class class Student { //private member of class private: string Full_Name; float Student_GPA; int Student_Rank; //public class members public: //function to get student name void setStudentdata(string SN, float GPA, int rank) { Full_Name = SN;Student_GPA = GPA;Student_Rank = rank; } //return student name function void getStudentdata(string &SN, float &GPA, int &rank) { SN = Full_Name;GPA = Student_GPA;rank = Student_Rank;} }; int main() { Student info[3];//variable declaration string studentName[3]; float studentGpa; int studentRank; //prompt user to enter name GPA and rank for (int i = 0; i < 3; i++) { cout << "\nEnter record for Student " << i + 1; cout << "\nName: ";cin.get(); getline(cin >> ws, studentName[i]); cout << "GPA: "; cin >> studentGpa; cout <<…Modify songVerse to play "The Name Game" (see OxfordDictionaries.com), by replacing "(Name)" with userName but without the first letter.Ex: If userName = "Kaitlin" and songVerse = "Banana-fana fo-f(Name)!", the program prints:Banana-fana fo-faitlin! Ex: If userName = "Kaitlin" and songVerse = "Fee fi mo-m(Name)", the program prints:Fee fi mo-maitlin Note: You may assume songVerse will always contain the substring "(Name)". *Please write this code in C++*Java Questions - (Has 2 Parts). Based on each code, which answer out of the choices "A, B, C, D, E" is correct. Each question has one correct answer. Thank you. Part 1 - 7. Which is possibly a composite class? class Seed { ... }class Fruit { Seed s1 = new Seed(); }class Apple extends Fruits { ... }class Orange extends Apple { ... }class ApplePie { ApplePie a1 = new ApplePie(); } A. FruitB. AppleC. ApplePieD. OrangeE. Seed Part 2 - 8. Given the following code, the output is __. class Apple { int x = 5; }class Orange { int y = 6; }class Tangerine { int z = 7; } class Banana { Apple a1 = new Apple(); Orange o1 = new Orange(); Tangerine t1 = new Tangerine(); public int show() { return a1.x + o1.y + t1.z; }} public class Sample { public static void main(String[] args) { Banana b1 = new Banana(); System.out.println(b1.show()); }} A. 5B. 6C. 7D. 18E. 5+6+7
- Can Someone help me create this code? You are working for a financial advisor who creates portfolios of financial securities for his clients. A portfolio is a conglomeration of various financial assets, such as stocks and bonds, that together create a balanced collection of investments. For example: Client-A purchases 100 shares of IBM $1 par value common stock on Jan. 20, 2020, for a total purchase price of $10,000 USD. Dividends for the year have been declared at $5 per share of common. Client-A purchases 5 bonds is1sued by Intel Corporation with a face value of $1000 per bond and a stated interest rate of 7.5% on Jan 3, 2020, for a total purchase price of $5,000 USD. The bonds mature on Dec. 31, 2025. It is your job to create an object-oriented application that will allow the financial advisor to maintain the portfolios for his/her clients. You will need to create several classes to maintain this information: Security, Stock, Bond, Portfolio, and Date. The characteristics of…Design Foodcart class and Food class so that the following code provides the expected output.cart1 = Foodcart()food1 = Food('Burger','Chillox',180)food2 = Food.createFood('Cake','Mr. Baker',1000)print("===========================")print(food1)print("===========================")cart1.addFood(food1,food2)print("===========================")cart1.setCartName("Foodpanda")cart1.addFood(food1,food2)cart1.addFood(Food('Steak','Woodhouse Grill',2000))print("Total Price Available:",Foodcart.totalPrice)print("===========================")print("Total Foods created:",Food.totalFoods)print("===========================")cart1.printCartDetails()print("===========================")cart1.removeFood("French Fry")print("===========================")cart1.removeFood("Steak")print("===========================")cart1.printCartDetails()print("===========================")print("Total Price Available:",Foodcart.totalPrice)Output:====================================Food Info : Burger, Food Shop : Chillox,…The local Driver’s License Office has asked you to write a program that grades the written portion of the driver’s license exam. The exam has 10 multiple-choice questions. Here are the correct answers: 1. B 2. D 3. A 4. A 5. C 6. A 7. B 8. A 9. C 10. D A student must correctly answer 7 of the 10 questions to pass the exam. Write a class named DriverExam that holds the correct answers to the exam in an array field. The class should also have an array field that holds the student’s answers. The class should have the following methods: • passed. Returns true if the student passed the exam, or false if the student failed. • totalCorrect. Returns the total number of correctly answered questions. • totalIncorrect. Returns the total number of incorrectly answered questions. • questionsMissed. An int array containing the question numbers of the questions that the student missed, i.e. answered incorrectly. Test the class in a separate class, DriverTest , that asks the user to enter a student’s…
- Question: Implement the following functions in your class: getTotalWords (returns the amount of total words), getUniqueWords (returns the amount of unique words), getMostUsedWord, (returns the word that is most used) getMaxOccurrence (returns how many times the most used word occured). Name them as indicated here. The code to add the functions to: import edu.princeton.cs.algs4.*;import edu.princeton.cs.algs4.LinearProbingHashST;import edu.princeton.cs.algs4.SeparateChainingHashST;import edu.princeton.cs.algs4.ST;import edu.princeton.cs.algs4.SequentialSearchST;import edu.princeton.cs.algs4.In;import edu.princeton.cs.algs4.StdOut; public class TestPerf { public static long LinearProbingHashST(String x[]) { LinearProbingHashST<String, Integer> st = new LinearProbingHashST<String, Integer>(); long start = System.currentTimeMillis(); for(int i = 0; i < x.length; i++){ String key = x[i]; if…23.5 LAB: Random values (Use Python) In main.py define the RandomNumbers class, which has three integer attributes: var1, var2, and var3. Write getter method for each attribute: get_var1(), get_var2() and get_var3(). Then write the following 2 instance methods: set_random_values( ) - accepts a low and high integer values as parameters, and sets var1, var2, and var3 to random numbers within the range of the low and high input values (inclusive). get_random_values( ) - prints out the 3 random numbers in the format: "Random values: var1 var2 var3" Ex: If the input is: 15 20 the output may be: Random values: 17 15 19 where 17, 15, 19 can be any random numbers within 15 and 20 (inclusive). Note: When submitted, your program will be tested against different input range to verify if the three randomly generated values are within range.MUST BE IN JAVA In an n-sided regular polygon, all sides have the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains: - A private int data field named n that defines the number of sides in the polygon with default value 3. - A private double data field named side that stores the length of the side with default value 1. - A private double data field named x that defines the x-coordinate of the polygon’s center with default value 0. - A private double data field named y that defines the y-coordinate of the polygon’s center with default value 0. - A no-arg constructor that creates a regular polygon with default values. - A constructor that creates a regular polygon with the specified number of sides and length of side, centered at (0, 0). - A constructor that creates a regular polygon with the specified number of sides, length of side, and x- and y-coordinates. - The accessor and…
- A .The following JavaScript command adds a method to a built-in class that can be called on any object instance of that class.Array.prototype.scramble = function() { this.sort(function() { return 0.5 – Math.random(); });} Select one: True False B. Suppose you have written a JavaScript for loop, and one of the statements that will execute with each iteration of the loop includes an anonymous function that uses the for loop’s counter variable, i. Which statement about this loop is true? a.The anonymous function will execute when it is called by the program, using the value ofiat the time it was encountered in the loop. b. The anonymous function will throw an error if it is called by the program after theforloop has finished iterating. c. The anonymous function will execute when it is called by the program, using the value ofiafter the final iteration of the loop. d.The forloop signals the JavaScript interpreter to copy the body of the anonymous function but not its…This code is not working. I'm getting errors.Can you check code again. #include <cctype>#include <cstring>#include <iostream> using namespace std; class Song {private: char* title; char* author; char* genre; float time; public: Song(); Song(char* t, char* a, char* g, float ti); ~Song(); void Set(char* t, char* a, char* g, float ti); void Display(); bool operator<(Song& a); bool operator<=(Song& a); bool operator>(Song& a); bool operator>=(Song& a); bool operator==(Song& a); bool operator!=(Song& a);}; Song::Song() { title = NULL; author = NULL; genre = NULL; time = 0;} Song::Song(char* t, char* a, char* g, float ti) { title = new char[strlen(t) + 1]; strcpy(title, t); author = new char[strlen(a) + 1]; strcpy(author, a); genre = new char[strlen(g) + 1]; strcpy(genre, g); time = ti;} Song::~Song() { delete[] title; delete[] author; delete[] genre;}…/*** Simulate helping a student*/ #include <stdio.h>#include <stdlib.h>#include <unistd.h>#include "ta.h" void help_student(int sleep_time, int student_number){ //printf("helping student %d for %d seconds waiting students = %d\n",student_number,sleep_time, waiting_students); printf("Helping a student for %d seconds waiting students = %d\n",sleep_time, waiting_students); sleep(sleep_time);} what are the errors in this code?