Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Sun Furnace Company provides furnace repair service to residential customers

ID: 3933032 • Letter: T

Question

The Sun Furnace Company provides furnace repair service to residential customers. It has asked you to develop a program that calculates and outputs a customer's bill. The company offers 2 types of service: Standard and Deluxe. Its rates vary, depending on the type of service. Rates are computed as follows :

Standard service : $100.00 plus first 30 free service minutes. Charges for over 30 service minutes are $0.75 per minute. If the furnace is not fueled by natural gas, there is an additional $25 charge.

Deluxe service : $25.00 plus :

a. For service starting between 8:00 a.m. and 4:00 p.m. the first 25 service minutes are free; charges for more than 25 minutes are $0.40 per minute.

b. For service starting between 4:01 p.m. and 7:59 a.m. the first 15 service minutes are free; charges for more than 15 minutes are $0.60 per minute.   

c. If the furnace is not fueled by natural gas, there is an additional $15 charge.

The program MUST use 4 functions :

- A void function which outputs the following :

Welcome to Sun Furnace Bill calculator

You will be asked for the following information :

* Service Type (S,s,D,d)

* Furnace Type (G,g for gas, O,o for non gas)

* Service Minutes

* Service Shift (D,d indicates service started between 8 a.m. and 4 p.m. N, n indicates service started between 4:01 p.m. and 7:59 a.m. This is only asked if the service type is Deluxe.

- A value returning function which calculates and returns the billing amount for standard service.  

- A value returning function which calculates and returns the billing amount for Deluxe service.

- A void function which outputs the bill. For example  :

Customer Bill

Service Type : Deluxe Furnace Type : Gas

Service Shift : Day Minutes : 80

Bill Amount : $ 55.00

Explanation / Answer

import java.util.Scanner;
public class FurnaceCompany{
    public static void intro(){
        System.out.println("Welcome to Sun Furnace Bill calculator. You will be asked for the following information : * Service Type (S,s,D,d) * Furnace Type (G,g for gas, O,o for non gas) * Service Minutes * Service Shift (D,d indicates service started between 8 a.m. and 4 p.m. N, n indicates service started between 4:01 p.m. and 7:59 a.m. This is only asked if the service type is Deluxe.");
    }

    public static double billingDeluxe(double sm, double fixed, double freeservice, double rate, double additionalCharge){
        return fixed + rate*(sm-freeservice) + additionalCharge;
    }

    public static double billingStandard(double sm, double fixed, double freeservice, double rate, double additionalCharge){
        return fixed + rate*(sm-freeservice) + additionalCharge;
    }

    public static void billOutput(char st, char ft, char ss, double sm, double amount){
        System.out.println("Customer Bill Service Type : "+st+"     Furnace Type : "+ft+" Service Shift : "+ss+"          Minutes : "+sm+" Bill Amount : $ "+amount);
    }

    public static void main(String[] args) {
        double fixed, freeservice, rate, additionalCharge=0.0;
        intro();
        Scanner sc = new Scanner(System.in);
        System.out.print("Service Type (S,s,D,d): ");
        Character st = sc.next().charAt(0);
        System.out.print(" Furnace Type (G,g for gas, O,o for non gas): ");
        Character ft = sc.next().charAt(0);
        System.out.print(" Service Minutes: ");
        double sm = sc.nextDouble();
        if (Character.toLowerCase(st)=='d'){
            fixed = 25;
            System.out.print(" Service Shift (D,d indicates service started between 8 a.m. and 4 p.m. N, n indicates service started between 4:01 p.m. and 7:59 a.m: ");
            Character ss = sc.next().charAt(0);
            if(Character.toLowerCase(ft)=='g'){
                additionalCharge = 15;
            }
            if(Character.toLowerCase(ss)=='d'){
                freeservice = 25;
                rate = 0.40;
            }
            else{
                freeservice = 15;
                rate = 0.60;
            }
            double amount = billingDeluxe(sm, fixed, freeservice, rate, additionalCharge);
            billOutput(st, ft, ss, sm, amount);
        }
        else{
            fixed = 100;
            if(Character.toLowerCase(ft)=='g'){
                additionalCharge = 25;
            }
            rate = 0.4;
            freeservice = 25;
            double amount = billingStandard(sm, fixed, freeservice, rate, additionalCharge);
            billOutput(st, ft, 'n', sm, amount);
        }

    }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote