Reset author name to chosen name

This commit is contained in:
2025-10-19 21:58:41 -05:00
parent 03c2474f78
commit 12cf757236
574 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package lab11_chloefontenot;
import java.util.Scanner;
/**
*
* @author chloe
*/
public class DoWhileEvent2 {
public static void main(String[] args) {
System.out.println("Please enter a positive number to add it to sum or -1 to quit");
Scanner scan = new Scanner(System.in);
int num = scan.nextInt(); //2 Condition: initialize the condition of the loop
int sum = 0; //1 task: Initialize the task
do //1 condition: What is the condition?
{
sum += num; //2 task: task of the loop and its update
System.out.println("Please enter a positive number to add it to sum or -1 to quit");
num = scan.nextInt();//3 condition update the condition of the loop.
}
while (num != -1);
System.out.println("Total " + sum);
}
}