Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

what is wrong with this code? identifier errors and fix it import java.util.Scanner; public class HandsOn { public static void main(String[] args){ int val

 what is wrong with this code?  identifier errors and fix it 

 

import java.util.Scanner;

public class HandsOn {

public static void main(String[] args){

int val = 0;

int count = 0;

Scanner in = new Scanner(System.in);

System.out.println("Enter a value: ");

val = in.nextInt();

System.out.println("Enter a number to multiply the doubled Value by: ");

count = in.nextInt();

static int doubleMe(int val) {

return val*2;

}

static int quadrupleMe(int val) {

int quad = doubleMe(val);

return quad*2;

}

static int doubleMeTimes(int val, int count) {

for(int i = 1; i <= count; i++) {

times = doubleMe(val);

}

return times;

}

System.out.println("Value: " + val);

System.out.println("Value Doubled: " + val);

System.out.println("Value Quadrupled: " + quad);

System.out.println("Value Doubled and Multiplied by count: " + times);

}

}

Step by Step Solution

3.40 Rating (141 Votes )

There are 3 Steps involved in it

Step: 1

Here are the issues with the code and suggested fixes 1 doubleM... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Document Format ( 2 attachments)

PDF file Icon
663e56be298ff_957811.pdf

180 KBs PDF File

Word file Icon
663e56be298ff_957811.docx

120 KBs Word File

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions

Question

Why should clubs create goals and objectives? AppendixLO1

Answered: 1 week ago