Write Program Take N Elements Insert Heap One One Include Function Print Elements Heap B W Q43778764

A) Write a program to take n elements and insert them into aheap one by one. Include a function to print out the elements inthe heap.

B) Write a program to take n elements and insert them into abinary tree. Include a function to print out the elements in thetree.

Add commenting if possible so I can learn from the code.Thanks!

Programming language C++ please.

Expert Answer


Answer to A) Write a program to take n elements and insert them into a heap one by one. Include a function to print out the elemen…

Write Program Takes Arithmetic Expression String Returns Value Example User Enters 5 3 2 4 Q43894554

Write a program that takes an arithmetic expression as a stringand returns its value. For example, if the user enters “5*3+2+4”then the program should return 21. Assume that the user enters avalid expression. The program should handle the followingarithmetic operators *, +, /, -. Bonus (20 points): Add the abilityto handle parentheses. Note: You must use a null terminatedcharacter array to represent a string. In other words, you cannotuse the class string.

In C++ please

Expert Answer


Answer to Write a program that takes an arithmetic expression as a string and returns its value. For example, if the user enters �…

Write Program Takes Positive Integer Input Outputs String 1 S O S Representing Integer Bin Q43829619

i can not get this code to reverse the output. Write a program that takes in a positive integer as input, and outputs a string of 1s and Os representing the integer in bi

Write a program that takes in a positive integer as input, and outputs a string of 1’s and O’s representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the O’s and 1’s in reverse order. You will need to write a second function to reverse the string. Ex: If the input is: the output is: 110 Your program must define and call the following two methods. The method integerToReverseBinaryO should return a string of 1’s and Os representing the integer in binary (in reverse). The method reverseString() should return a string representing the input string in reverse. public static String integer ToReverseBinary(int integerValue) public static String reverseString(String inputString) Show transcribed image text Write a program that takes in a positive integer as input, and outputs a string of 1’s and O’s representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the O’s and 1’s in reverse order. You will need to write a second function to reverse the string. Ex: If the input is: the output is: 110 Your program must define and call the following two methods. The method integerToReverseBinaryO should return a string of 1’s and Os representing the integer in binary (in reverse). The method reverseString() should return a string representing the input string in reverse. public static String integer ToReverseBinary(int integerValue) public static String reverseString(String inputString)

Expert Answer


Answer to i can not get this code to reverse the output. …

Write Program Translates Alphabetic Phone Number Numeric Form Using C Based Character Arra Q43787168

In C++

Write a program that translates an alphabetic phone number into numeric form using C-based character arrays: Enter Phone Numb

Write a program that translates an alphabetic phone number into numeric form using C-based character arrays: Enter Phone Number: Numeric Form: CALLATT 2255288 In case you do not have your cell phone handy, remember that: 1..@. 2 – ABC, 3 = DEF 4 = GHI, 5 = JKL, 6 = MNO, 7 PQRS, 8 = TUV, 9 = WXYZ. If the original phone number contains non- alphabetic characters besides the ones listed for the number 1 (., ‘, or @’), your program should leave the results unchanged. For example: Enter Phone Number: Numeric Form: 1-800-COL-LECT 1-800-265-5328 You may assume that any letters entered into your program by the user could upper or lower case. Specifications: The program needs to store the original phone number in array of characters. The program also needs to store the numeric number in a second array of characters. You may assume that the phone number is no more than 15 characters long, and any letters that are entered into the program by the user may be upper or lower case. Define a constant N for your array size and use it throughout your program. If you execute the program, the following information should be displayed: 1-800-765-5234 1-800-765-5328 > main.o Enter Phone Number: Numeric Form: > main.o Enter Phone Number: Numeric Form: -> main.o Enter Phone Number: Numeric Form: 1800KrIeHn 7 18005743467 011886INTERNTL. 011886468376851 HINT: You will need to initialize your two arrays with the NULL(” ‘) character (ASCII Code 0) so that if you do not print out 15 numbers, you will not print out junk values left over in other elements in the arrays. You will need to use a while() loop to read in your characters, and use a for() loop for your conversion. You may also find a switch() statement to be extremely useful… Show transcribed image text Write a program that translates an alphabetic phone number into numeric form using C-based character arrays: Enter Phone Number: Numeric Form: CALLATT 2255288 In case you do not have your cell phone handy, remember that: 1..@. 2 – ABC, 3 = DEF 4 = GHI, 5 = JKL, 6 = MNO, 7 PQRS, 8 = TUV, 9 = WXYZ. If the original phone number contains non- alphabetic characters besides the ones listed for the number 1 (., ‘, or @’), your program should leave the results unchanged. For example: Enter Phone Number: Numeric Form: 1-800-COL-LECT 1-800-265-5328 You may assume that any letters entered into your program by the user could upper or lower case. Specifications: The program needs to store the original phone number in array of characters. The program also needs to store the numeric number in a second array of characters. You may assume that the phone number is no more than 15 characters long, and any letters that are entered into the program by the user may be upper or lower case. Define a constant N for your array size and use it throughout your program. If you execute the program, the following information should be displayed: 1-800-765-5234 1-800-765-5328 > main.o Enter Phone Number: Numeric Form: > main.o Enter Phone Number: Numeric Form: -> main.o Enter Phone Number: Numeric Form: 1800KrIeHn 7 18005743467 011886INTERNTL. 011886468376851 HINT: You will need to initialize your two arrays with the NULL(” ‘) character (ASCII Code 0) so that if you do not print out 15 numbers, you will not print out junk values left over in other elements in the arrays. You will need to use a while() loop to read in your characters, and use a for() loop for your conversion. You may also find a switch() statement to be extremely useful…

Expert Answer


Answer to Write a program that translates an alphabetic phone number into numeric form using C-based character arrays: Enter Phone…

Write Program Uses Array Doubles Initialized Whatever Values Wish Write Methods Calculate Q43903176

Write a program that uses an array of doubles initialized towhatever values you wish. Write methods to calculate and return theminimum and a method to calculate and return the maximum value inthe array. You must write YOUR ORIGINAL methods for minimum andmaximum. You MAY NOT use Math class methods or other librarymethods.

Write an additional method that accepts the array as a parameterand then creates and returns a new array with all the same valuesas the original plus 10. (num +=10)

So far I have:

public static void main (String[] args)
{
Scanner scan = new Scanner (System.in);
  
//making an array
double myArray[];
myArray = new double[5];
  
System.out.println (“Enter numbers:”);
  
//putting in a numbers in an array
for (int a = 0; a < 5; a++)
{
myArray[a] = scan.nextDouble();
}
  
//print the array
  
for (int a = 0; a < 5; a++)
{
System.out.print (myArray[a] + ” “);
}
  
System.out.println();
System.out.println (“The Min value in the array is: ” +findtheMinimum(myArray));
System.out.println();
System.out.println (“The Max value in the array is: ” +findTheMaximum(myArray));
System.out.println();
System.out.println (“This is the new array: ” +addTen(myArray));
  
}
//Find the minimum number
public static double findtheMinimum (double[] myArray)
{
double min = myArray[0];
  
for (int a = 1; a < 5;a++)
{
if( myArray[a] < min)
{
min = myArray[a];
}
}
  
return min;
  
  
}
//Find the maximum number
public static double findTheMaximum (double[] myArray)
{
double max = myArray[0];
  
for (int a = 1; a < 5;a++)
{
if( myArray[a] > max)
{
max = myArray[a];
}
}
  
return max;
}

public static double addTen (double[] myArray)
{
double myArray2[];
myArray2 = new double[5];
  
for (int a = 0; a < 5; a++)
{
myArray2[a] = myArray[a];
}
return myArray;
}
}

The add ten portion won’t work. Please help.

Expert Answer


Answer to Write a program that uses an array of doubles initialized to whatever values you wish. Write methods to calculate and re…

Write Program Uses Array High Temperatures Hometown Last Week Sunday Saturday Write Metho Q43885677

Write a program that uses an array of high temperatures for your hometown from last week (Sunday - Saturday). Write methods tjava pseudocode and source code help?Write a program that uses an array of high temperatures for your hometown from last week (Sunday – Saturday). Write methods to calculate and return the lowest high temperature (minimum) and a method to calculate and return the highest high temperature (maximum) in the array. You must write YOUR ORIGINAL methods for minimum and maximum. You MAY NOT use Math class methods or other library methods. Write an additional method that accepts the array as a parameter and then creates and returns a new array with all the same values as the original plus 10. (num +=10) Show transcribed image text Write a program that uses an array of high temperatures for your hometown from last week (Sunday – Saturday). Write methods to calculate and return the lowest high temperature (minimum) and a method to calculate and return the highest high temperature (maximum) in the array. You must write YOUR ORIGINAL methods for minimum and maximum. You MAY NOT use Math class methods or other library methods. Write an additional method that accepts the array as a parameter and then creates and returns a new array with all the same values as the original plus 10. (num +=10)

Expert Answer


Answer to Write a program that uses an array of high temperatures for your hometown from last week (Sunday – Saturday). Write meth…

Write Program Uses Array High Temperatures Hometown Last Week Sunday Saturday Write Metho Q43888184

Write a program that uses an array of high temperatures for your hometown from last week (Sunday - Saturday). Write methods tjava pseudocode help ?Write a program that uses an array of high temperatures for your hometown from last week (Sunday – Saturday). Write methods to calculate and return the lowest high temperature (minimum) and a method to calculate and return the highest high temperature (maximum) in the array. You must write YOUR ORIGINAL methods for minimum and maximum. You MAY NOT use Math class methods or other library methods. Write an additional method that accepts the array as a parameter and then creates and returns a new array with all the same values as the original plus 10. (num +=10) Show transcribed image text Write a program that uses an array of high temperatures for your hometown from last week (Sunday – Saturday). Write methods to calculate and return the lowest high temperature (minimum) and a method to calculate and return the highest high temperature (maximum) in the array. You must write YOUR ORIGINAL methods for minimum and maximum. You MAY NOT use Math class methods or other library methods. Write an additional method that accepts the array as a parameter and then creates and returns a new array with all the same values as the original plus 10. (num +=10)

Expert Answer


Answer to Write a program that uses an array of high temperatures for your hometown from last week (Sunday – Saturday). Write meth…

Write Program Uses Loops Perform Following Steps Prompt User Input Two Integers Firstnum S Q43787568

Write a program thatuses while loops to perform the following steps:

  1. Prompt the user to input two integers: firstNum and secondNum(firstNum must be less than secondNum).
  2. Output all odd numbers between firstNum and secondNum.
  3. Output the sum of all even numbers between firstNum andsecondNum.
  4. Output the numbers and their squares between 1 and 10.
  5. Output the sum of the square of the odd numbers betweenfirstNum and secondNum.
  6. Output all uppercase letters.

The output should look like this!

xid-48982742_1

Expert Answer


Answer to Write a program that uses while loops to perform the following steps: Prompt the user to input two integers: firstNum an…

Write Program Uses Scanner Object Read Doubles Representing Positive Daily Temperatures Pe Q43889009

Write a program that uses a Scanner object to read in doubles representing positive daily temperatures over a period of time.

Write a program that uses a Scanner object to read in doubles representing positive daily temperatures over a period of time. You will need to keep track of the total temperatures that you read in and the lowest temperature that you read in. Using a loop (your choice on type) keep reading in temperatures (doubles) until you read in-1. Then print the total number of temperatures that you read in and the lowest temperature. Note: if-1 is entered at the start, then the program won’t print anything. Examples Sample Input (on one line) Sample Output 10.5 21.5 16.8 12.6 9.2 15.6 -1 6 9.2 27.3 3.4 1.5 6.7 -1 51.5 Run Tests ✓ Grading 5 Problem6.Java Full Screen New ☆ 11 Test Case 1 O Not run NOT RUN Test Case 2 NOT RUN Not run Test Case 3 Not run NOT RUN Test Case 4 NOT RUN Not run Test Case 5 NOT RUN Not run Show transcribed image text Write a program that uses a Scanner object to read in doubles representing positive daily temperatures over a period of time. You will need to keep track of the total temperatures that you read in and the lowest temperature that you read in. Using a loop (your choice on type) keep reading in temperatures (doubles) until you read in-1. Then print the total number of temperatures that you read in and the lowest temperature. Note: if-1 is entered at the start, then the program won’t print anything. Examples Sample Input (on one line) Sample Output 10.5 21.5 16.8 12.6 9.2 15.6 -1 6 9.2 27.3 3.4 1.5 6.7 -1 51.5 Run Tests ✓ Grading 5 Problem6.Java Full Screen New ☆ 11 Test Case 1 O Not run NOT RUN Test Case 2 NOT RUN Not run Test Case 3 Not run NOT RUN Test Case 4 NOT RUN Not run Test Case 5 NOT RUN Not run

Expert Answer


Answer to Write a program that uses a Scanner object to read in doubles representing positive daily temperatures over a period of …

Write Program Uses Scanner Object Read Doubles Representing Positive Daily Temperatures Pe Q43894823

java
Write a program that uses a Scanner object to read in doubles representing positive daily temperatures over a period of time.Write a program that uses a Scanner object to read in doubles representing positive daily temperatures over a period of time. You will need to keep track of the total temperatures that you read in and the lowest temperature that you read in Using a loop your choice on type keep reading in temperatures doubles until you read in. Then print the total number of temperatures that you read in and the lowest temperature Note: iftis entered at the start, then the program won’t print anything Examples Sample input lon one linel Sample Output 10.5 21.5 16.8 12.6 9.2 15.6- 2uJ4574 515 Problem java New X Full Screen Grading Test Case 1 NOT RUN S est Case 2 NOT RUN Test Case 3 NOT RUN Test Case 4 NOT RUN S Test Case 5 Show transcribed image text Write a program that uses a Scanner object to read in doubles representing positive daily temperatures over a period of time. You will need to keep track of the total temperatures that you read in and the lowest temperature that you read in Using a loop your choice on type keep reading in temperatures doubles until you read in. Then print the total number of temperatures that you read in and the lowest temperature Note: iftis entered at the start, then the program won’t print anything Examples Sample input lon one linel Sample Output 10.5 21.5 16.8 12.6 9.2 15.6- 2uJ4574 515 Problem java New X Full Screen Grading Test Case 1 NOT RUN S est Case 2 NOT RUN Test Case 3 NOT RUN Test Case 4 NOT RUN S Test Case 5

Expert Answer


Answer to Write a program that uses a Scanner object to read in doubles representing positive daily temperatures over a period of …