Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description: Dominion Gas Corporation would like you to develop an application that helps them calculate the gas consumption bill of their customers. The application

Problem Description:

Dominion Gas Corporation would like you to develop an application that helps them calculate the gas consumption bill of their customers. The application would first ask for the customer account number, the customer name and the type of account (residential or commercial). Then the application asks for the gas consumed during the past month by the customer in MCF (the unit used to indicate the amount of gas consumed). After gathering all this information the application calculates the bill based on the type of account (residential or commercial) and prints out the bill.

The code must be in line with the programming standards covered in class and should provide sufficient comments to explain the code elements.

Technical Specifications:

The application will have two classes: Account and AccountTest

The Account class will have the following elements in it:

INSTANCE VARIABLES:

Instance variable for account number and its property

Instance variable customer name and its property

Instance variable balance and its property

Instance variable to store mcf

Instance variable to store the rate of the account ($8.99 for residential, $11.99 for commercial)

Instance variable to store usage charge for consumption of gas (mcf * rate)

Instance variable to store municipal charge (2% of usage charge)

Instance variable to store excise tax (5% of usage charge)

CONSTRUCTOR

A constructor that accepts the account number and the customer name and uses those two values to initialize the appropriate instance variables (account number, customer name)

METHODS

A method that calculates the bill.

This method asks the user for the type of account (residential/commercial) for which the bill is to be calculated.

It also asks the user for the MCF used.

Based on these two pieces of information, it calculates the usage charge, municipal charge, excise tax and balance. It stores all these figures in their appropriate instance variables.

A method that displays the bill.

This method simply prints out all the information about the bill such as the customer name, account number, the usage charge, municipal charge, excise tax and balance (see figures for samples of output)

The AccountTest class will have the following elements in it:

The Main method, which performs the following actions:

Asks for the account number, reads it in and stores it in a variable.

Asks for the customer name, reads it in and stores it in a variable.

Uses these two pieces of information to create an object using the Account classs constructor.

Calls the method that calculates the bill for the object created.

Calls the method that displays the bill for the object created.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago