Question

In: Computer Science

Complete the following Java-like pseudocode. Your code should multiply all the numbers in nums and store...

Complete the following Java-like pseudocode. Your code should multiply all the numbers in nums and store it in a variable called mult

     public static void main(String[] args){

                        int[] nums = <some array values>;

Solutions

Expert Solution

Here is the pseudocode given below:

Java-like pseudocode:

public static void main(String[] args)   // start main method
   {
       int[] nums = {4,5,6,7};       // declares an Array of integers and initialize the value
       int mult=1;       // declare the mult variable and initialize the value 1

       // use for loop

       for(int i=0;i<nums.length;i++)
       {
           // multiply all the numbers in nums and store it in a variable called mult

           mult = mult*nums[i];  
       }

       // print the Value of Multiply all the numbers

       System.out.println("Value of Multiply all the numbers: "+mult);
   }   // end of the main

Screenshot of the code:


Related Solutions

Complete the following Java code. Compute the average of all the numbers in nums and store...
Complete the following Java code. Compute the average of all the numbers in nums and store it in a variable called average      public static void main(String[] args){                         int[] nums = <some array values>;
This is an intro to java question. Please post with pseudocode and java code. Problem should...
This is an intro to java question. Please post with pseudocode and java code. Problem should be completed using repetition statements like while and selection statements. Geometry (10 points) Make API (API design) Java is an extensible language, which means you can expand the programming language with new functionality by adding new classes. You are tasked to implement a Geometry class for Java that includes the following API (Application Programming Interface): Geometry Method API: Modifier and Type Method and Description...
Intro to java Problem, Please provide code and Pseudocode. Not able to compile correct numbers. Problem...
Intro to java Problem, Please provide code and Pseudocode. Not able to compile correct numbers. Problem 7: Simple Calculator (10 points) (General) Calculators represent the most basic, general-purpose of computing machines. Your task is to reduce your highly capable computer down into a simple calculator. You will have to parse a given mathematical expression, and display its result. Your calculator must support addition (+), subtraction (-), multiplication (*), division (/), modulus(%), and exponentiation (**). Facts ● Mathematical expressions in the...
How Heapify is done (theory, pseudocode, and examples) the examples used Java code please (in your...
How Heapify is done (theory, pseudocode, and examples) the examples used Java code please (in your own words)
write JAVA code with the following condition Write the pseudocode for a new data type MyStack...
write JAVA code with the following condition Write the pseudocode for a new data type MyStack that implements a stack using the fact that you have access to a queue data structure with operations enqueue(), dequeue(), isEmpty(). Remember that every stack should have the operations push() and pop(). Hint: use two queues, one of which is the main one and one is temporary. Please note that you won’t be able to implement both push() and pop() in constant time. One...
I needv pseudocode and a flowchart for the following java code public class AcmePay { public...
I needv pseudocode and a flowchart for the following java code public class AcmePay { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int hours, shift, retirement = 0; do { System.out.print("Enter the number of hours worked (>0): "); hours = scanner.nextInt(); } while (hours <= 0); do { System.out.print("Enter shift [1 2 or 3]: "); shift = scanner.nextInt(); } while (shift < 1 || shift > 3); if (shift == 2 || shift ==...
Write a java code to find the following. For numbers 501 to 999, how many numbers...
Write a java code to find the following. For numbers 501 to 999, how many numbers will have the sum of the digits equal to 10. 501, sum of digits=6 502, sum of digits=7 503, sum of digits=8 504, sum of digits=9 505, sum of digits=10 506, sum of digits=11
C++ programming Complete the code to input and store all the information in the structure Book:...
C++ programming Complete the code to input and store all the information in the structure Book: title, author, year and pages. Complete the function print() with arguments and code to print a Book variable in the following format: Book title: <title> Book author: <name> Published in <year> Number of pages: <pages> #include <iostream> using namespace std; struct Book { string title; string author; string year; int pages; }; void print(/*arguments*/) { //Complete function } int main() { //Declare structure variable...
write code with proper comments for ever step the code should be in form of pseudocode                            &
write code with proper comments for ever step the code should be in form of pseudocode                                    To Print Triangle of any size, by taking size as input. To Print Triangle of any size, by taking size as input. If size is 4 then triangle is: To calculate Factorial of any number. To calculate the power of any given number. To Print Table of Any Number up till 10: as shown in this figure. for a program which reads 10 integers...
Write a Java test program, all the code should be in a single main method, that...
Write a Java test program, all the code should be in a single main method, that prompts the user for a single character. Display a message indicating if the character is a letter (a..z or A..Z), a digit (0..9), or other. Java's Scanner class does not have a nextChar method. You can use next() or nextLine() to read the character entered by the user, but it is returned to you as a String. Since we are only interested in the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT