Question

In: Computer Science

I need this in PSEUDOCODE: Write a method, called PrintNumbers, that prints out the following sequence...

I need this in PSEUDOCODE:

Write a method, called PrintNumbers, that prints out the following sequence of numbers. The method must use a for-loop to print the outputs. HINT: “To get started: what’s the pattern from number X to (X+1)? Does it apply to the next pair of numbers?” 8 12 18 26 36 48 62

Solutions

Expert Solution

Pattern Found:

Total number of elements in Sequence is 7

8          12        18       26       36         48        62 ->1

      4            6         8        10        12       14 ->2 (Difference of elements in Row 1)

            2             2         2           2         2 ->3 (Difference of elements in Row 2)

PSEUDOCODE :

Method PrintNumber

  Initialize sequenceNumber to 8

Initialize addDifference to 4

Set Counter To 1

Start For Loop Till Counter is Less Than or Equal to 7

print sequenceNumber

sequenceNumber= sequenceNumber+addDifference

addDifference= addDifference+2

End For Loop

End Method PrintNumber

  


Related Solutions

Write a Java method called printAvg that takes in two floating point numbers and prints out...
Write a Java method called printAvg that takes in two floating point numbers and prints out the average of them.
In C++ Write a function called findMatchedGenome that takes three genomes and a sequence and prints...
In C++ Write a function called findMatchedGenome that takes three genomes and a sequence and prints the list of matched genomes The function must be named findMatchedGenome The function will take in 4 string input parameters in the order Genome 1, a string Genome 2, a string Genome 3, a string sequence (sub-sequence of the genomes), a string The function should not return anything. Unexpected values might be passed into a function and your function should be able to handle...
Write a method called printIsMultiple that receives a pair of integers and prints true if the...
Write a method called printIsMultiple that receives a pair of integers and prints true if the second is a multiple of the first; false, otherwise
Java Write a method that reads a text file and prints out the number of words...
Java Write a method that reads a text file and prints out the number of words at the end of each line
Q1: Write a method called testArray that accepts a one-dimensional array of any size and prints...
Q1: Write a method called testArray that accepts a one-dimensional array of any size and prints the following summary information: a) all array elements at an even index b) every fifth element c) all elements but the first and last Write a program that demonstrates this method by using an array of 20 random integers from 100 to 200. Q2: Write a method called displayGrid that accepts a two-dimensional array of integer values from 0 to 99 and prints this...
Java programming. Write a public Java class called DecimalTimer with public method displayTimer, that prints a...
Java programming. Write a public Java class called DecimalTimer with public method displayTimer, that prints a counter and then increments the number of seconds. The counter will start at 00:00 and each time the number of seconds reaches 60, minutes will be incremented. You will not need to implement hours or a sleep function, but if minutes or seconds is less than 10, make sure a leading zero is put to the left of the number. For example, 60 seconds:...
For the following double stranded DNA sequence, write out the mRNA sequence that will be synthesized...
For the following double stranded DNA sequence, write out the mRNA sequence that will be synthesized from the DNA. (Hint: which strand will you use to build your mRNA?) Then write out the amino acid polypeptide that will be synthesized from this sequence and correctly label the 5’ – 3’ directionality of the mRNA and amino acid fragments: Gene: 5’- A T G C T T C A A G T T G G T C C T C C...
In Java I need a Flowchart and Code. Write the following method that tests whether the...
In Java I need a Flowchart and Code. Write the following method that tests whether the array has four consecutive numbers with the same value: public static boolean isConsecutiveFour(int[] values) Write a test program that prompts the user to enter a series of integers and displays it if the series contains four consecutive numbers with the same value. Your program should first prompt the user to enter the input size—i.e., the number of values in the series.
i need the pseudocode and python program for the following problem. Besides the user entering the...
i need the pseudocode and python program for the following problem. Besides the user entering the number of books purchased this order, they are asked for the number of points earned for the year before this order and the number of books ordered this year before this order. There are bonus points awarded based on the number of books previously ordered and number ordered now. These points should be added to the variable points: Current order: 0 Previous Orders >...
I NEED THIS IN PSEUDOCODE: SWITCH/CASE 2 - Complete the pseudocode below by including a SWITCH...
I NEED THIS IN PSEUDOCODE: SWITCH/CASE 2 - Complete the pseudocode below by including a SWITCH statement that takes the user input (an integer between 26-30) and prints out a count up in its English equivalent. For example: if the user inputs “26”, the code will print “twenty-six”, “twenty-seven” on the next line, and so on up to “thirty”. If the user inputs “30”, the code will print “thirty” and finish. CREATE inputNum PRINT ("Please enter a number between 26-30...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT