Write a function that gets a number between 1 and 20 from the user. Return the number. (Use a while loop to make sure you get a number in that range) Write a function that sums the first n odd numbers (1 + 3 + 5 + ...). Use n as a parameter and return the sum. Write a mainline (code outside of a function) that: calls the first function to get a number n (between 1 and 20) calls the second function to get the sum of the first n odd numbers prints the sum
Q: Which of the following statements gives the best description of the relationship between regular…
A: In the given question Regular expression is the language which is used to describe the language and…
Q: Explain what an overloaded method is and give an example by writing some Java code.
A: History of overloaded method Java uses methods to explain how an object behaves. Statements are…
Q: a) b) 5¹ 1 c) 1²e-dr dx 2x 24 dx ¹(cos x)² dx
A:
Q: Consider the following functions: • log₂ x ● X. (3/2)* ● x/log₂ x • 2 ● • log₂ x ● ●x² ● √x (log₂…
A: Here is the order:
Q: What is software re-engineering?
A: To define software reengineering.
Q: Description: For this assignment, you will be simulating an online ordering platform for your user…
A: Program: #include <iostream>#include <bits/stdc++.h> using namespace std; void…
Q: Write all the three properties of shortest path and generic algorithm for solving a single source…
A: - An edge-weighted digraph is a digraph where we associate weights or costs with each edge. -A…
Q: PC4 192.168.B.120/24 PC3 192.168.B.125/24 PC1 192.168.A.5/24 PC2 192.168 A 10/24 Switch 1 Switch 2…
A: 1: Routing table: R1:
Q: How can you tell whether an application is affecting a device's output? Is it feasible to maintain…
A: - We need to talk about effect on a devices output because of an application and to talk about…
Q: Complete the code to return the output. y "this is a random sentence." print (y._____ ()) = THIS IS…
A: The upper() method converts all lowercase letters in the string to uppercase and returns them.…
Q: Write merits and demerits of memory card and USB drive.
A: Merits 1 - Memory cards can offer large amount of storage space while being small in size. 2 - Due…
Q: design 3 x 3 bit multiplier then pass it on the ROM then show the value in a 7 segment display
A: The question has been answered in step2
Q: The solution must be recursive. DownToOne:Takes an integer nand prints out the numbers from ndown…
A: So we need to take integer n and print out the numbers from n down to 1, each no on its own line…
Q: ANSWER A B C D PLEASE ANSWER THE REQUIRED (COMPLETE) THIS THRU EXCEL ONLY WITH STEP BY STEP SOLUTION…
A: Algorithm : We have placed the value given and rest fill with 999 : And also demand is given by the…
Q: is data proce
A: Data Processing: Data processing means to deal with the data for example to change over its format.…
Q: Q.1.4 Q.1.5 Q.1.6 Q.1.7 Which of the following is not a floating-point data types in Java? Float;…
A: Answer:- 1.4. The correct answer is B), String. In Java, a sequence of characters is referred to…
Q: Explain Network services
A: Different types of network services are given below.
Q: If your database system supported both a static and a dynamic tree index (say, ISAM and B+ trees),…
A: Introduction In this question we will discuss whether we will consider using the static index in…
Q: Undirected graph is given with the list of edges. Build an adjacency matrix. Print the number of…
A: Here is the algorithm regarding the given problem with explanation:
Q: Problem: A 1024 × 1024 array of 32-bit numbers is to be normalized as follows. For each column, the…
A: Each 32-bit number comprises 4 bytes. Each page holds 1024 numbers.
Q: Which parts of the information system pertain to organisational structure, administrative duties,…
A: The challenges of organization, administration, and technology are all addressed. Senior executives…
Q: Consider the following sets: A={2,4,5} B = {4,9,10,12} C = {1,3,8,9,10,12,14} I)…
A: Answer: Given that A = { 2,4,5 } B = {4,9,10,12} C = {1,3,8,9,10,12,14} Here we will get for AUB is…
Q: Explain features of Windows operating system
A: An Operating System (OS) is a software that acts as an interface between computer hardware…
Q: Thank you, but I have 10K directories that have tens of thousands of file in them. How to use the…
A: Here is the solution:
Q: Why do device drivers need to be loaded when the BIOS already provides code for hardware-to-OS…
A: Introduction: Traditional x86 BIOS issues At launch, the BIOS only contains code that enables the…
Q: inputAndPrintReverse: Inputs integers from the user until the user enters 0, then prints the…
A: Answer: Algorithms: 1.We have create a inputAndPrintReverse to pass the input as arguments 2.if…
Q: WALL STREET INVESTORS BELIEVE THAT BITCOIN WILL HIT $10,000 NEXT RATHER THAN $30,000.
A: As Bitcoin (BTC) managed to hold support above the $20,000 level and climb as high as $22,000, the…
Q: A device's output may be impacted by an application, but how can you tell? Is it possible to…
A: Given: How can you detect whether an application affects the output of a device? If you have an…
Q: lete method to create an array of random integers. Method Specification The method takes in three…
A: Let's define a method called getArray() that will return the required array.
Q: symbols used for flowchart Discuss various is drawing flowchart. How is How helpful in writing…
A: What Does Flow Chart Mean? A flow chart is a visual summary or diagram that depicts the sequential…
Q: Program: File GamePurse.h: class GamePurse { // data int purseAmount; public: // public…
A: Answer: we have combined the three program and it is run fine
Q: Recognize the benefits of IT and utilise them in your career and personal life.
A: Information technology (IT) is a field that can open up various vocation ways. In IT, you could be…
Q: The following four statements describe differences between Finite Automata and Pushdown Automata.…
A: The question has been answered in step2
Q: 4. Calculate the perceptron network if there are 3 inputs x,-1.7, x,-5.9, x-3 and b= -1.8. Synaptic…
A: Please check the step 2 for solution
Q: Q3: Draw the digital signals for the bit string 01101101011 using NRZ-L, NRZI. Bipolar-AMI,…
A: There are different ways of data encoding like NRZ-L , NRZI, Bipolar-AMI, etc. Each has its own…
Q: Discuss differences between domain class diagram and design class diagram using the Dic
A: Introduction In database modelling, a domain class diagram is often referred to as a conceptual…
Q: Give example of Numeric Constant in Programming?
A: A numeric constant comprises of numerals, a discretionary driving sign, and a discretionary decimal…
Q: (a) Assume x, y and z are integer variables and x = 5 and y = 6. Trace and write the values of the…
A: Dear Student, In the case of post increment, it assigns to a variable first, then increases the…
Q: What is the new sematic elements in HTML5? i. ii. iii. iv. a. i and iv b. ii and iii c. i, iii…
A: In the given question HTML stand for hiper text markup language. HTML was originally created as a…
Q: Write mode vs append mode
A: Please find the detailed answer for the option C.
Q: Q3) Using selection sort Algorithm sort the following data: (5) round 20 35 15 12 27 5 1 2 3 4 5 13
A: Given To know about the Selection sort .
Q: #include #include #include #include #include "card.h" #include "deck.h" #include "hand.h"…
A: It is defined as a general-purpose programming language and is widely used nowadays for competitive…
Q: How selective retransmission is a valuable TCP addition Is there anything wrong with this approach?
A: Introduction: Packets are acknowledged cumulatively by the mobile or stationary host. This makes the…
Q: Name and describe at least four ways you utilize ICT in your everyday life.
A: ICT: Since we live in the information age, ICT is growing globally. ICT can ease commerce with…
Q: two disadvantage of linear temporal logic
A: You are asking for two disadvantages of linear temporal logic which are given below:
Q: Write all the three properties of shortest path and generic algorithm for solving a single source…
A: The following is a list of the three characteristics of the shortest path:1.) There is one and only…
Q: Write a Java method that accepts an array of integer as input. The method returns true or false to…
A: * Java Code * import java.util.*; public class Main { static boolean isSorted(int[] array) //…
Q: If x = 8, what will be displayed after execution of the following statement?
A: In this question, we are asked to give the correct output of the given code when x is 8: if x >=…
Q: Explain peer-peer networking. Write its advantages and disadvantages.
A: Networking is the exchange of information and ideas among people with a common profession or special…
Q: Daffodil Institute is granted the block 172.20.110.0/16. The administrator wants to create 16…
A: IP(Internet Protocol) is a 32-bit address that is used to uniquely identify the device in a network.…
Return the number. (Use a while loop to make sure you get a number in
that range)
Write a function that sums the first n odd numbers (1 + 3 + 5 + ...). Use n
as a parameter and return the sum.
Write a mainline (code outside of a function) that:
calls the first function to get a number n (between 1 and 20)
calls the second function to get the sum of the first n odd numbers
prints the sum
143
Step by step
Solved in 3 steps with 4 images
- Write a function sequence that accepts an number ( int ) and that prints a sequence of numbers that starts at the given number and obeys the following rules: the number 1 is the last number in the sequence (e.g stop ) if the number if even, the next number is half of it if the number is odd, the next number is one more Specifications: use a while loop print each number in the sequence one per lineWrite a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N: Lather and rinse." numCycles times, where N is the cycle number, followed by "Done.". End with a newline. Example output with input 2: 1: Lather and rinse.2: Lather and rinse.Done.Hint: Declare and use a loop variable. #include <iostream>using namespace std; /* Your solution goes here */ int main() {int userCycles; cin >> userCycles;PrintShampooInstructions(userCycles); return 0;} Please help me with this problem using c++.Could you solve this Question please? 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 duplicatesabc has no duplicates Print a line like one of the above for each of the strings in test_dups. Obs:Copy the code below into your program def histogram(s): d = dict() for c in s: if c not in d: d[c] =…
- Write a function that returns the average of the first N numbers,where N is a parameter.Code in Python Write a function, print_perfect_cubes(n), that takes an integer parameter n and prints the perfect cubes starting from 03 = 0 and ending with n3. When n is negative, the function prints nothing; but do not check for this condition with an "if" statement, it is unneccesary; use a for loop that will automatically print nothing when n < 0. Hint for choosing the right range for your for loop: In the general case, when n is not negative, your function will need to print n+1 different values. For example: Test Result print_perfect_cubes(2) 0 1 8 print_perfect_cubes(5) 0 1 8 27 64 125 print_perfect_cubes(-10)I JUST WANT TO MAKE SURE IF MY HOMEWORK ANSWERS ARE CORRECT C++ HOMEWORKS Write the program Write a function to output a pyramid like this * *****. ********* Answer: #include <iostream> using namespace std; void printPyramid(int n) { for (int i = 0; i < n; i++) { for (int j = 0; j < n - i - 1; j++) { cout << " "; } for (int j = 0; j <= i; j++) { cout << "*"; } for (int j = 0; j < i; j++) { cout << "*"; } cout << endl; } } int main() { printPyramid(4); return 0; } Write a function to count how many numbers in one string.. Answer: #include <iostream> #include <string> using namespace std; int countNumbers(string str) { int count = 0; for (char c : str) { if (isdigit(c)) { count++; } } return count; } int main() { string str = "Hello, World,…
- 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 duplicatesabc has no duplicates Print a line like one of the above for each of the strings in test_dups. test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]The following requirments that weren't mentioned for solving the following Python Code below: The provided code for alphabet, test_dups, test_miss, and histogram. Your implementation of the has_duplicates function. A loop that outputs duplicate information for each string in test_dups. Your implementation of the missing_letters function. A loop that outputs missing letters for each string in test_miss. Write a function called missing_letters that takes a string parameter and returns a new string with all the letters of the alphabet that are not in the argument string. The letters in the returned string should be in alphabetical order. Your implementation should use a histogram from the histogram function. It should also use the global variable alphabet. It should use this global variable directly, not through an argument or a local copy. It should loop over the letters in alphabet to determine which are missing from the input parameter. The function missing_letters should…I submitted my question for my homework and I need to submit it today. The answer I received last night from Bartleby didn't have an output. If it did I needed to apply an input for the output on Idle. Write a function called missing_letters that takes a string parameter and returns a new string with all the letters of the alphabet that are not in the argument string. The letters in the returned string should be in alphabetical order. Your implementation should use a histogram from the histogram function. It should also use the global variable alphabet. It should use this global variable directly, not through an argument or a local copy. It should loop over the letters in alphabet to determine which are missing from the input parameter. The function missing_letters should combine the list of missing letters into a string and return that string. Write a loop over the strings in list test_miss and call missing_letters with each string. Print a line for each string listing the…
- I). Write a program in c++ with class 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.Bartleby answered my homework and 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 duplicatesabc has no duplicates Print a line like one of the above for each of the strings in test_dups. True needs to be defined. I tried to code it but didn't accept and got an error message.Please answer it in Python Write a double_consonant function , It takes a word as a parameter and has two return values : A Boolean value equals True If the word contains a double consonant ( The same consonant twice in a row ), under these circumstances , The second value returned is the double consonant ; If there are no double consonants , Function should return False and None. relevant information : To simplify the exercise , We don't use words that contain multiple double consonants ( for example ,“successor”) Test your functionality on . Example : double_consonne('arrivee') vaut True, 'r'.double_consonne('bonbon') vaut False, Nonedouble_consonne('reussite') vaut True, 's'