*1. This program takes in user input and calculates each persons share of the cost from a trip. *2. This program uses Scanner for input/ *3. This code calculates the final cost less a discount discount.. *4. This code displays and formats the result. */ import java.util.*; public class NdunaJoyDiscuss4Wk4 {     public static void main(String[] args) {         String name = "Joy Nduna"; //My given name         String date = "April 08, 2023";//Date code is implemented         int course = 141; // The course number         int section = 7382; // The section number         int numDiscuss = 4; // Assignment week number         // Displaying my name, course/section number, discussion week number, date         System.out.println("Name: "+name+("\n")+"Class CMIS: "+course+"\n"+"Section : "+section+("\n")+"Assignment 1: Week: "+numDiscuss+("\n")+"Date: "+date);              // Create a scanner object to read user input Scanner stdin = new Scanner(System.in); // Prompt for two integers separated by a space int numPeople = 0;//Set number of people to be counted double bills = 0; double billTotal = bills; int count = 0; //Initializing a constant variable final double DISCOUNT_RATE =.15; //Prompting for user input and using sentil for user control of input System.out.print("Enter you bill between $0 and $500 or 0 to exit : "); bills = stdin.nextDouble();    //While loop to control iteration while (bills != 0) {      billTotal += bills;      count++;      numPeople++;      System.out.print("Enter you bill between $0 and $500 or 0 to exit : "); bills = stdin.nextDouble(); } //Validating dauser input         if (count == 0) {      System.out.println("Invalid entry! : \"");          }         else {          double eachPersonsBillShare;                    //Calculating the trip costs          double discount = billTotal * DISCOUNT_RATE; double finalBillTotal = billTotal - discount;          eachPersonsBillShare = finalBillTotal / numPeople;          //Displaying the result.          System.out.println();          System.out.println("The total bill for " + numPeople + " people is $ "+ billTotal + " less a discount of " + DISCOUNT_RATE + " percent.");          System.out.println("The final bill for is: $ " + finalBillTotal);          System.out.printf("Each person's share of the cost is $%1.2f"                   + " \n " , eachPersonsBillShare);      }      stdin.close(); }                      } CAN YOU ADD SOMETHING TO THIS PROGRAM AND ADD THE RESULT. THANK YOU :)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

*1. This program takes in user input and calculates each persons share of the cost from a trip.
*2. This program uses Scanner for input/
*3. This code calculates the final cost less a discount discount..
*4. This code displays and formats the result.
*/
import java.util.*;
public class NdunaJoyDiscuss4Wk4 {

    public static void main(String[] args) {
        String name = "Joy Nduna"; //My given name
        String date = "April 08, 2023";//Date code is implemented
        int course = 141; // The course number
        int section = 7382; // The section number
        int numDiscuss = 4; // Assignment week number
        // Displaying my name, course/section number, discussion week number, date
        System.out.println("Name: "+name+("\n")+"Class CMIS: "+course+"\n"+"Section : "+section+("\n")+"Assignment 1: Week: "+numDiscuss+("\n")+"Date: "+date);    
        
// Create a scanner object to read user input
Scanner stdin = new Scanner(System.in);
// Prompt for two integers separated by a space
int numPeople = 0;//Set number of people to be counted
double bills = 0;
double billTotal = bills;
int count = 0;
//Initializing a constant variable
final double DISCOUNT_RATE =.15;
//Prompting for user input and using sentil for user control of input
System.out.print("Enter you bill between $0 and $500 or 0 to exit : ");
bills = stdin.nextDouble();
  
//While loop to control iteration
while (bills != 0) {
     billTotal += bills;
     count++;
     numPeople++;
     System.out.print("Enter you bill between $0 and $500 or 0 to exit : ");
bills = stdin.nextDouble();
}
//Validating dauser input        
if (count == 0) {
     System.out.println("Invalid entry! : \"");    
     }
  
     else {
         double eachPersonsBillShare;
         
         //Calculating the trip costs
         double discount = billTotal * DISCOUNT_RATE;
double finalBillTotal = billTotal - discount;
         eachPersonsBillShare = finalBillTotal / numPeople;
         //Displaying the result.
         System.out.println();
         System.out.println("The total bill for " + numPeople + " people is $ "+ billTotal + " less a discount of " + DISCOUNT_RATE + " percent.");
         System.out.println("The final bill for is: $ " + finalBillTotal);
         System.out.printf("Each person's share of the cost is $%1.2f"
                  + " \n " , eachPersonsBillShare);
     }
     stdin.close();
}



                
    }

CAN YOU ADD SOMETHING TO THIS PROGRAM AND ADD THE RESULT. THANK YOU :) 

 

No hand written and fast answer with explanation 

Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education