1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
maks197457 [2]
3 years ago
12

You are working as the IT support person for an electrician. The electrician has asked you to create a program that generates a

report to show the month’s customers, the total number of customers, and the amount owed across all customers. Each customer record contains a customer number, customer name, number of kilowatt hours used (up to, but not including 1000.0) and the amount owed. The amount owed is based on the number of kilowatt hours used based on the following rate schedule: Number of Kilowatts Used Cost 0.0 -199.9 $0.11 per kilowatt 200.0+ $0.08 per kilowatt Your program should gather the input data from the user. Then your program should calculate and print the each customer’s record and amount owed on a weekly payroll report. All input data and calculated amounts should appear on the report. The total amount owed and total number of customers should appear at the end of the report. When there are no customers, an error message should appear instead of a report. You may assume the customer number and customer name have already been validated and will never included an empty value.
Computers and Technology
1 answer:
Alexus [3.1K]3 years ago
7 0

Answer:

Customer.java

public class Customer {

private int customerNo;

private String customerName;

private double kwhourconsumed;

private double amountowed;

public int getCustomerNo() {

return customerNo;

}

public void setCustomerNo(int customerNo) {

this.customerNo = customerNo;

}

public String getCustomerName() {

return customerName;

}

public void setCustomerName(String customerName) {

this.customerName = customerName;

}

public double getKwhourconsumed() {

return kwhourconsumed;

}

public void setKwhourconsumed(double kwhourconsumed) {

this.kwhourconsumed = kwhourconsumed;

}

public double getAmountowed() {

return amountowed;

}

public void setAmountowed(double amountowed) {

this.amountowed = amountowed;

}

Override

public String toString() {return "Customer [customerNo=" + customerNo + ", customerName=" + customerName + ", kwhourconsumed="  + kwhourconsumed + ", amountowed=" + amountowed + "]";

}

}

PayrollReport.java

import java.util.ArrayList;

import java.util.List;

import java.util.Scanner;

public class PayrollReport {

public static Customer getCustomerDetails(Scanner sc)

{

Customer cust= new Customer();

System.out.println("Enter Customer Number");

int customerNo=sc.nextInt();

cust.setCustomerNo(customerNo);

System.out.println("Enter Customer Name");

String customerName=sc.next();

cust.setCustomerName(customerName);

System.out.println("Enter Customer kilowatt hours used");

double kwhourconsumed=sc.nextDouble();

cust.setKwhourconsumed(kwhourconsumed);

return cust;

}

public static void main(String[] args) {

Scanner sc = new Scanner(System.in); //Used Scanner Class to take Input from User

//List to add all the customer details

//Customer POJO is created so that multiple Objects can be stored

List<Customer> list= new ArrayList<Customer>();

//User shoud Enter Y to add more customer details and N to stop Entering

while(true)

{

//Method to Input Customer Details

Customer cust=getCustomerDetails(sc);

//Getting back the object and setting to the list

list.add(cust);

System.out.println("To Add more customer Enter 'Y' or Else 'N'");

String yn=sc.next();

if(yn.equals("Y"))

continue;

else

break;

}

sc.close();

double amountOwed=0.0;

for(int i=0;i<list.size();i++)

{

double hrconsumed=list.get(i).getKwhourconsumed();

if(hrconsumed>0.0 && hrconsumed<=199.9)

{

amountOwed=(hrconsumed*0.11);

list.get(i).setAmountowed(amountOwed);}

else if(hrconsumed>= 200.0)

{

amountOwed=(double)(199.99*0.11)+(hrconsumed-200.0)*0.08;

list.get(i).setAmountowed(amountOwed);

}

}System.out.println("///////////////////////////");

System.out.println("Weekly Payroll Report");

double totalamountowed=0.0;

for(int i=0;i<list.size();i++)

{

System.out.println("CUSTOMER - "+i+1);

System.out.println("Customer No- "+list.get(i).getCustomerNo());

System.out.println("Customer Name- "+list.get(i).getCustomerName());

System.out.println("Customer kilowatt hours used

"+list.get(i).getKwhourconsumed());

System.out.println("Customer amount owed in $- "+list.get(i).getAmountowed());

totalamountowed=totalamountowed+list.get(i).getAmountowed();

}

System.out.println("///////////////////////////");

System.out.println("END Report");

System.out.println("Total Number of Customer "+list.size());

System.out.println("Total Amount Owed In $ "+totalamountowed);

}

}

Explanation:

Made some modifications for clarity and simplicity.

You might be interested in
01110101<br> +00100100<br> 00010001
Tomtit [17]

Answer:

Hey mate......

Explanation:

This is ur answer....

<h3>01110101 + 00100100 + 00010001 = 1,220,202</h3>

Hope it helps!

mark me brainliest plz.....

Follow me! :)

4 0
3 years ago
Pa answer po thank you​
Arturiano [62]

Answer:

1. software (1st row)

2. binary code (6th row)

3. pc language (11th row)

I found these three!!!

4 0
3 years ago
Read 2 more answers
Help plz
Sonbull [250]

1.

first = float(input("First Entry = "))

second = float(input("Second Entry = "))

def func(num1, num2):

   return max(num1, num2)

print(func(first, second))

2.

first = input("First Entry = ")

second = input("Second Entry = ")

def func(word1, word2):

   return sorted([word1,word2])[0]

print(func(first, second))

I hope this helps!

8 0
3 years ago
Want to.learn about computers​
MAVERICK [17]
Yes...I do want to learn about computer
6 0
3 years ago
You are installing several servers that will be used as web servers to reach customers over the Internet. Where should you place
just olya [345]

Answer: DMZ

Explanation:

 DMZ is the demilitarized zone network and it is use in providing he various services to the users or customers by using the public internet. It basically contain organizational services in the logical and physical sub-network and usually works in large network.

The main purpose of DMZ that it is use as web server over the internet for reaching to the users and customers. It also add one additional layer in the organization for security purpose.

Some of the services that DMZ provides as web server, DNS and proxy server.  

4 0
3 years ago
Other questions:
  • Which type of system must you connect to and use to make changes to Active Directory?
    15·1 answer
  • Can you help me correct a sentence?
    13·1 answer
  • What is the order in which windows systems receiving and process multiple gpos?
    7·1 answer
  • Conduct online research to determine specific conflict-resolution and management techniques and skills that would be beneficial
    5·1 answer
  • How can multiple items be selected at the same time in aJList?
    8·1 answer
  • Using a caesar cypher with an offset of three characters (a -&gt; d, b -&gt;e, ...., z -&gt; c), what would be the correct cyphe
    6·1 answer
  • Anyone know the answer I need help
    12·1 answer
  • 9. DIMMs used in servers can provide additional reliability if they use what specific technology.
    8·1 answer
  • How can injection attacks be prevented? Check all that apply
    6·2 answers
  • Create a Python program that computes the cost of carpeting a room. Your program should prompt the user for the width and length
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!