// This code contains ERRORS!
int choice, num1, num2;
Scanner keyboard = new Scanner(System.in);
do
{
System.out.print(“Enter a number: ”);
num1 = keyboard.nextInt();
System.out.print(“Enter another number: ”);
num2 = keyboard,nextInt();
System.out.println(“Their sum is ” + (num1 + num2));
System.out.println(“Do you want to do this again? ”);
System.out.print(“1 = yes, 0 = no ”);
choice = keyboard.nextInt();
} while (choice = 1)
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Additional Engineering Textbook Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with C++: Early Objects
Problem Solving with C++ (9th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Computer Science: An Overview (12th Edition)
- Don't put wrong code else downvotearrow_forwardfunction performTask () { var valuel; valuel - document.getElementById ("FirstBox").value; if (valuel == "Yes") { document.getElementById ("paragraphl").innerHTML = "Agreed"; ) else if (valuel =- "No") { document.getElementById ("paragraphl").innerHTML = "Sorry"; ) else ( alert ("Error") Describe the purpose of the following JavaScript statements from the function performTask (). i. alert("Error"), ii. value1 = document.getElementByld("FirstBox").value; iii. document.getElementByld("paragraph1").innerHTML = "Agreed";arrow_forward#includecstdio.h> int x=10; void func1() 7 printf("x=%d\n", x); return; 8 10 int func2(int a, int b) 15 return a+b; 16 18 19 ... func3(...) 20 21 .. return ... int main() 27 { int x-1, y=2; func1(); 28 29 30 int z=func2(x, y); printf("z-%d\n", z); 31 34 Figure 2. C Program for Q2 What is the output after execution of line 29 and 32? a. b. func3() in line 19 to 23 is incomplete. Write the function, func30 to compute and print the volume of cuboid with length x, width y and height z. c. Complete line 33 to call func3() that you created in part (b).arrow_forward
- JAVA:arrow_forward// DebugFive1 // Adds your lunch bill // Burger and hot dog are $2.59 // Grilled cheese and fish are $1.99 // Fries are 89 cents import java.util.*; public class DebugFive1 { publicstaticvoidmain(Stringargs[]) { Scanner input =newScanner(System.in); finaldouble HIGH_PRICE =2.59; finaldouble MED_PRICE =1.99; finaldouble LOW_PRICE =0.89; String usersChoiceString; int usersChoice; double bill; System.out.println("Order please\n1 - Burger\n2 - Hotdog" + "\n3 - Grilled cheese\n4 - Fish sandwich"); usersChoiceString = input.next(); usersChoice == Integer.parseInt(usersChoiceString); if(usersChoice ==1&& usersChoice ==2) bill = bill + HIGH_PRICE; else bill = bill + MED_PRICE; System.out.println("Fries with that?\n1 - Yes\n2 - No"; usersChoiceString = input.next() usersChoice = Integer.parseInt(usersChoiceString); if (usersChoice =1) bill = bill + LOW_PRICE; System.out.println("Bill is " + bill); } }arrow_forwardWhich aggregating procedures are permitted for struct variables but not array variables, and which are not allowed for array variables?arrow_forward
- а. int GreaterThan(int no) { if (no > 10) printf("%d is greater than 10", no); else printf("%d is less than 10", no); }arrow_forwardint nums[] = {7,2,5,6,7,2,3,4,6); int target = 12; int loc = 0; int iterations = 0; boolean found = false; while (!found && locarrow_forwardgetRandomLib.h: // This library provides a few helpful functions to return random values// * getRandomInt() - returns a random integer between min and max values// * getRandomFraction() - returns a random float between 0 and 1// * getRandomFloat() - returns a random float between min and max values// * getRandomDouble() - returns a random double between min and max values// * getRandomBool() - returns a random bool value (true or false)// * getRandomUpper() - returns a random char between 'A' and 'Z', or between min/max values// * getRandomLower() - returns a random char between 'a' and 'z', or between min/max values// * getRandomAlpha() - returns a random char between 'A' and 'Z' or 'a' and 'z'// * getRandomDigit() - returns a random char between '0' and '9', or between min/max values// * getRandomChar() - returns a random printable char//// Trey Herschede, 7/31/2019 #ifndef GET_RANDOM_LIB_H#define GET_RANDOM_LIB_H #include <cstdlib>#include <random>#include…arrow_forwardInt cube ( int x){ // returns cube of x : return x.x.x. :)* O False Truearrow_forwardHomework - identical arrays for one-dimensional: Write a test program which prompts a user to enter the size of two arrays as well as to fill their elements. After that, the program checks the same contents of the elements of the two arrays. If these arrays are equal, the program displays message which is "The two arrays are identical". If not equal, displaying "The two arrays are not identical". Write an equals method that reads two arrays and displays these messages above.arrow_forwardTrue or FalseReference variables can be used only to reference objects.arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,