Write a program that determines if a number is prime or not. You must define a function that will identify if a number is prime or not. (You can refer to discussion in the third video.) Expand the code so that it counts how many prime numbers there are between 1 to 100000. Display the count at the end of the program.
Q: 15.1 (The Triangle class) Design a class named Triangle that extends GeometricObject. The class…
A: Algorithms: START Base classclass GeometricObject Create GeometricObject() Make…
Q: A telephone company charges 10 cents per minute for all calls outside the customer's area code that…
A: c++ code telephonenumber.cpp #include <bits/stdc++.h> using namespace std; void…
Q: Write program that creates 6x6 random array and find the max, min, average of the array. Print the…
A: ALGORITHM:- 1. Create a 2D random matrix of 6*6 size. 2. Find the minimum, maximum and average…
Q: Q#1: a. Write a C++ program to create two dimensional array in main function which accept marks of…
A: Step 1:- Program Approach:- 1.Include header files 2.Create two functions:- a)void avg(int m[4][6])…
Q: in C++ language please
A: A C++ program for the given criteria is as follows, File name: “main.cpp” #include <iostream>…
Q: Given an array of integers, return a new array such that each element at index i of the new array is…
A: Given:
Q: Write a class Person. It should have the following three attributes: a. Name b. Age c. Gender…
A: #include <iostream> #include <string> using namespace std; // Person class class Person…
Q: Basic data type in c++
A: Given: Basic data type in c++
Q: 1. The input integer, n Constraints The value is >= 1 Output The first line will contain a message…
A: Algorithm: Include standard header file and namespace std. Create a main function Declare the…
Q: e a program that accepts user's section, and display them back with the format "*** Section: s…
A: Write a C++ program that accepts the user's section as input, and displays them back with the format…
Q: Implement a circular queue using array which will support following operations. 1) Isempty() which…
A: A circular queue is a queue in which the items are inserted in a circular wat that is if the element…
Q: Given the following statement and assume the compiler provides 4 bytes for each int xp = new int…
A: Answer: We have written code for the how to allocate the memory without using the [] operator and…
Q: Write a program to shift all the zero present in the array in the alternative order, For example.…
A: PROGRAM CODE: #include <iostream> // include header file for input output stream…
Q: Write a C++ program that calculates the due amount for a cellular telephone bill. The cell company…
A: Here is the c++ code: See below step for code:
Q: In C++ programming.
A: Program designIn the absence of the data file as it is not possible to access external links on this…
Q: 7. PersonData and CustomerData Classes Design a class named PersonData with the following member…
A: C++ Code: main.cpp #include <iostream>#include <iomanip>#include "PersonData.h"#include…
Q: Write a function, singleParent, that returns the number of nodes in a binary tree that have only one…
A: Give a C++ Program that will have, singleParent, which returns the number of nodes in a binary tree…
Q: Given an array of integers that are out of order, determine the bounds of the smallest window that…
A: Required: In c++ language
Q: Write a program that would generate the following pattern. 0-1-1-1-1-1 10-1-1-1-1 110-1-1-1 1110-1-1…
A: The C++ code is given below with output screenshot
Q: 2, The union of two ordered sets (Sequential linear list) [Problem description] Give the union of…
A: Algorithm : Step1: take size of first order set Step2:Take size of second order set Step3:input…
Q: The local pet store has 35 different bowls with fish in them arranged in a circle in the “fish…
A: Complete answer is given below .
Q: Study guide help please in C++
A: The following characteristics of a binary search tree, a node-based binary tree data structure, are…
Q: #in c++
A: The algorithm for creating the program with given description is as follows: Create a class Student…
Q: h) Three strings are passed as parameters to a function named common. The function should print the…
A: Write the definition of the function named common() in C++ language that takes three strings passed…
Q: At run-time, a programmer can dynamically add to the set of Color values to specify a new additional…
A: In many programming languages, an enumeration, or "enum," defines a collection of constant symbolic…
Q: #include using namespace std; int main() { // Write your main here return 0; Instructions A room…
A: Here I have declared the variables required to store the length and width of various elements. Next,…
Q: Accomplish the following for the given class diagram, Course 1. Create the class implementation…
A: Program: //include the required header files #include <bits/stdc++.h> using namespace std;…
Q: in c++ language please
A: Program #include <iostream> using namespace std; typedef char el_t; class Stack {…
Q: Binary Search Tree,
A: First, let’s start by defining the height of a binary tree. The height of a node in a binary tree is…
Q: C++ compiler
A: In this program, we first prompt the user to enter a non-negative integer using cout, read it from…
Q: What is wrong with the following loop? int counter2 = 0; %3D while (counter2 < 10) { cout << "The…
A: This code goes to infinity because counter2 = 0 which is always be less then 10
Q: Create a functional program that can calculate the displacement and velocity of a free-falling body…
A: Program: #include <iostream> #include <cmath> using namespace std; void…
Q: In this project, you are going to introduce a Netflix-like (or Amazon prime…
A: Answer is given below.
Q: 1. Given an integer n and a string s taken input from user. Write a recursive function in C++…
A: Given: An integer n and a string s taken input from user. Requirement: Write a recursive C++ program…
Q: Implement the queue class as shown above. Use your queue to store the names of 5 students waiting…
A: 1. Start2. Initialize a Queue object called students.3. Prompt the user to enter an option from…
CREATE IN C++
Step by step
Solved in 4 steps with 3 images
- Q2: a- Write a program to pass two integer numbers as parameters to a function; this function is used to calculate and return the result of multiplication and division of the two numbers.# Exercise 11: # Modify and use your pseudocode for "Find the average score" from # Day 2 homework to create a function that takes 3 arguements # and returns their average # Get three numbers from a user and use your function to compute their averagecout > number; at using namespace std; int main () double salary, monthly; cout > salary; Monthly = static cast(salary)/12; I
- A(n) statement is a statement that returns a value to the statement that called the function. Select one: a.value b.exit C.return d.replaceComputer ScienceComputer-Assisted Instruction) The use of computers in education is referred to as computer- assisted instruction (CAI). Write a program that will help an elementary school student learn multiplication. Use the rand function to produce two positive one-digit integers. The program should then prompt the user with a question, such as How much is 6 times 7? The student then inputs the answer. Next, the program checks the student’s answer. If it’s correct, display the message "Very good!" and ask another multiplication question. If the answer is wrong, display the message "No. Please try again." and let the student try the same question repeatedly until the student finally gets it right. A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the user answers the question correctly.
- Help me write the pseudocode for this question. Thank you! :)Functions & Loops : Case Studies Prompt the user to input two positive integers. Variables: firstNum and secondNum (firstNum must be less than secondNum) (use while loop); create a user-defined function called validateUserInput() to validate the user's input. Use Call-by-Value. validateUserInput() is a value returning function. Output all odd numbers between firstNum and secondNum. (use while loop); create a user-defined function called oddNumbers(). Use Call-by-Value. oddNumbers() is a void function. Output the sum of all even numbers between firstNum and secondNum. (use while loop); create a user-defined function called sumEvenNumbers(). Use Call-by-Value. Declare a variable called sumEven in the main() for the sumEvenNumbers(). sumEvenNumbers() is a value returning function. Use sumEven to hold a returned value. Output the numbers and their squares between 1 and 10. (use while loop): create a user-defined function called displaySquareNumbers(). Call-by-Value.…TODO Create the function add func to complete the following TODO (). Create the add func() function, which accepts two arguments. The function should use the + operator to add the two arguments and then return the result. For instance, 3 should be returned if the arguments' input values are 1 and 2. Likewise, "good day" should be returned if the input arguments are "good" and "day." # TODO 6.1 print(f"add_func output for 1 + 2: {add_func(1, 2)}") print(f"add_func output for good + day: {add_func('good',' day')}") todo_check([ (add_func(1,2) == 3,'add_func() did not return 3 when using input values 1 and 2.'), (add_func('good',' day') == "good day",'add_func() did not return "good day" when using input values "good" and " day"') ])
- 1 - Nuclear Power Plant (python) The nuclear powerplant at Threeyedfish will automatically run a program to print a warning message when the reactor core becomes unstable. The warning message reads: NUCLEAR CORE UNSTABLE!!! Quarantine is in effect. Surrounding hamlets will be evacuated. Anti-radiationsuits and iodine pills are mandatory. Since the message contains crucial information, it should be printed three times. To do this, write a function that prints this message. This function has to be used three times.# Exercise 8: Create a function that takes the sum of three numbers and returns the value # Make sure to use the function and display the result # When you are done, get 3 numbers from a user and then print out the sum using your functionQuestion 6 # This function checks whether a given number is even or not def isEven(number): """ what it takes? a number what it does? determines if a number is even what it returns? if even, return 1 if odd, return -1 """ # your code goes in here defisEven(number): #check if the number is divisible by 2 by checking the remainder. if number % 2==0: #If remainder is 0, then its divisble by 2 and an even number #hence return-1 return1 else: #if remainder is not 0, it'll be 1, so its NOT divisible by 2 and its an odd number #hence return -1 return-1 Test case for question 6 try: if isEven(5) == -1: score['question 6'] = 'pass' else: score['question 6'] = 'fail' except: score['question 6'] = 'fail' isEven(5)