This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

shortcut to commenting out and uncommenting out lines of code

Santosh005

what is the shortcut to commenting out and uncommenting out lines of code

1 year ago
You are viewing a single comment. View All
1
SR-10WL-703359

/*
// * Name/Author: Sanvi
// * Student Number: 703359
// * Date: August 4, 2022
// * Program Name: Assignment 3: Higher or Lower
// */

// import java.util.Scanner; //import Scanner for keyboard input

// class Main { //class main
// public static void main(String[] args) { //start of program
// double randomnum = Math.random()*100+1; //randomnum is equal to a random decimal (up to 0.99) multiplied by 100 + 1 (to get a random value up to 100)
// Scanner scan = new Scanner(System.in); //creates Scanner named scan
// int playernum; //defines integer value with the name playernum

// int num = (int) randomnum; //casts randomnum as an integer value, this is the correct value that the player must guess

// System.out.println("Choose a number from 1 to 100"); //Prompts the user to input an integer value from 1 to 100
// playernum = scan.nextInt(); //scans for next integer input

// boolean check = playernum!=num; //if the player input is not equal to the program number, returns a true value, loops code.

// while(check!=false){ //the while loop repeats if check = false
// if(playernum<=num){ //if loop for when the player number is less than the chosen program number
// System.out.println("The number is higher"); //tells user that the program number is higher
// System.out.println("Choose a number from 1 to 100"); //asks the user to input another number
// playernum = scan.nextInt(); //scans for next integer input
// check = playernum!=num; //checks if playernum is equal to the program num
// } //kills if loop
// else if(playernum>=num){ //if the inputted number is less than the program number, runs this if loop
// System.out.println("The number is lower!"); //tells the user that the number is lower
// System.out.println("Choose a number from 1 to 100"); //tells the user to input another value from 1 to 100
// playernum = scan.nextInt(); //scans for next integer input
// check = playernum!=num; //checks if player input is equal to the program number
// }
// } //closes the while loop
// System.out.println("Correct! You win!"); //if the values are the same, congratulates user.
// scan.close(); //closes scanner
// } //closes sub
// } //kills program main/*
// * Name/Author: Sanvi
// * Student Number: 703359
// * Date: August 4, 2022
// * Program Name: Assignment 3: Higher or Lower
// * Program Description: When the program is run, a random number ranging from 1 and 100 will be generated. The user inputs a number and the program will respond with either higher, lower or the same, depending on if the number inputted by the user is either higher, lower or the same as the number generated by the program. After each guess, the program will inform the user that the number they inputted is either higher or lower than the one the computer has chosen. The program will continue to run until the user guesses the correct number, in which the loop will exit and the program will inform the user that they have guessed correctly.
// */

// import java.util.Scanner; //import Scanner for keyboard input

// class Main { //class main
// public static void main(String[] args) { //start of program
// double randomnum = Math.random()*100+1; //randomnum is equal to a random decimal (up to 0.99) multiplied by 100 + 1 (to get a random value up to 100)
// Scanner scan = new Scanner(System.in); //creates Scanner named scan
// int playernum; //defines integer value with the name playernum

// int num = (int) randomnum; //casts randomnum as an integer value, this is the correct value that the player must guess

// System.out.println("Choose a number from 1 to 100"); //Prompts the user to input an integer value from 1 to 100
// playernum = scan.nextInt(); //scans for next integer input

// boolean check = playernum!=num; //if the player input is not equal to the program number, returns a true value, loops code.

// while(check!=false){ //the while loop repeats if check = false
// if(playernum<=num){ //if loop for when the player number is less than the chosen program number
// System.out.println("The number is higher"); //tells user that the program number is higher
// System.out.println("Choose a number from 1 to 100"); //asks the user to input another number
// playernum = scan.nextInt(); //scans for next integer input
// check = playernum!=num; //checks if playernum is equal to the program num
// } //kills if loop
// else if(playernum>=num){ //if the inputted number is less than the program number, runs this if loop
// System.out.println("The number is lower!"); //tells the user that the number is lower
// System.out.println("Choose a number from 1 to 100"); //tells the user to input another value from 1 to 100
// playernum = scan.nextInt(); //scans for next integer input
// check = playernum!=num; //checks if player input is equal to the program number
// }
// } //closes the while loop
// System.out.println("Correct! You win!"); //if the values are the same, congratulates user.
// scan.close(); //closes scanner
// } //closes sub
// } //kills program main

7 months ago