Advertisement
thotfrnk

inclass work w4.java

Mar 26th, 2023
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1. import java.util.Scanner; //importing scanner
  2. public class Main { //program begins
  3.     public static void main(String[] args) { //main method
  4.  
  5.         Scanner input = new Scanner (System.in); //scanner declaration
  6.  
  7.         //variable declaration
  8.         String name;
  9.         double balance;
  10.  
  11.         //for the user to input their name and balance
  12.         System.out.println("Please enter your name: ");
  13.         name = input.next();
  14.  
  15.         System.out.println("Please enter your balance: $");
  16.         balance = input.nextDouble();
  17.  
  18.         //to output the user's name and balance
  19.         System.out.println("Customer: " +name);
  20.  
  21.         System.out.println("Total: $ " +displayAddressInfo(balance));
  22.     } //main method ends
  23.  
  24.     public static double displayAddressInfo(double amt_due) {
  25.         String line1 = "ABC Manufacturing", line2 = "47 Park Lane", line3 = "Omro, WI 54963";
  26.         String message = "This bill requires immediate attention!";
  27.         final int limit = 1000;
  28.  
  29.         if(amt_due > limit) {
  30.             System.out.println(message);
  31.         }
  32.  
  33.         System.out.println(line1);
  34.         System.out.println(line2);
  35.         System.out.println(line3);
  36.  
  37.  
  38.         return amt_due;
  39.     } //method displayAddressInfo
  40. } //program ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement