Question
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Document Format ( 2 attachments)
663e56be298ff_957811.pdf
180 KBs PDF File
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