473,396 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

can you help me with this java programming?

I just started the course and this crazy teacher wants me to do this hard ass question

The government of Mississauga has asked you to write a program that would calculate taxes for Mississauga residents. Your program should ask for the income (income) housing cost (housingCost), number of children (childTotal), and the total number of children in school (schoolChildren). It should then compute and print the tax payable or the refund due. The following are the tax regulations: the municipal tax rate is 19% but residents are not taxed on the first $15000 unless they pay more than $6000 for housing. For every child, residents get a $350 reduction, or $670 if the child is in school. This reduction never results in residents getting refunds unless their housing costs are less than $5800 and they have more than 2 children, at least one of them in school. If the tax payable is more than $1800, then it is increased by an additional 15% surtax.

an output window with the following inputs:


3 children with 1 child in school
35000 income
5999 house cost

this is what i have
// The "Taxesforresidents" class.
public class Taxesforresidents
{
public static void main (String[] args)
{
System.out.println ("Enter the icome");
double income = ReadLib.readDouble ();

System.out.println ("Enter the housing cost");
double housingCost = ReadLib.readInt ();

System.out.println ("Enter the number of children");
int childTotal = ReadLib.readInt ();

System.out.println ("Enter the total number of children in school");
int schoolChildren = ReadLib.readInt ();

if (housingCost <= 600000) income -= 1500000;

if (income < 0) income = 0;

double tax = taxableIncome * 19 / 100;
tax -= 35000 * childTotal;
tax -= (67000-35000) * schoolChildren;

if (tax < 0 && (housingCost > 580000 || childTotal < 3 || schoolChildren == 0)) tax = 0;

if (tax > 180000) tax += income * 15 / 100;
return tax;
}



} // end of main method
} // end of Taxesforresidents class
Mar 2 '08 #1
1 1311
sukatoa
539 512MB
I just started the course and this crazy teacher wants me to do this hard ass question

The government of Mississauga has asked you to write a program that would calculate taxes for Mississauga residents. Your program should ask for the income (income) housing cost (housingCost), number of children (childTotal), and the total number of children in school (schoolChildren). It should then compute and print the tax payable or the refund due. The following are the tax regulations: the municipal tax rate is 19% but residents are not taxed on the first $15000 unless they pay more than $6000 for housing. For every child, residents get a $350 reduction, or $670 if the child is in school. This reduction never results in residents getting refunds unless their housing costs are less than $5800 and they have more than 2 children, at least one of them in school. If the tax payable is more than $1800, then it is increased by an additional 15% surtax.

an output window with the following inputs:


3 children with 1 child in school
35000 income
5999 house cost

this is what i have
// The "Taxesforresidents" class.
public class Taxesforresidents
{
public static void main (String[] args)
{
System.out.println ("Enter the icome");
double income = ReadLib.readDouble ();

System.out.println ("Enter the housing cost");
double housingCost = ReadLib.readInt ();

System.out.println ("Enter the number of children");
int childTotal = ReadLib.readInt ();

System.out.println ("Enter the total number of children in school");
int schoolChildren = ReadLib.readInt ();

if (housingCost <= 600000) income -= 1500000;

if (income < 0) income = 0;

double tax = taxableIncome * 19 / 100;
tax -= 35000 * childTotal;
tax -= (67000-35000) * schoolChildren;

if (tax < 0 && (housingCost > 580000 || childTotal < 3 || schoolChildren == 0)) tax = 0;

if (tax > 180000) tax += income * 15 / 100;
return tax;
}



} // end of main method
} // end of Taxesforresidents class

Please post your code in tags...

Below return tax, right brace is not necessary...

What is ReadLib? is ReadLib implemented in DataInputStream? you forgot to initialize it...

variable taxableIncome, you forgot to initialize it too...

If you like to return a value from a method, change the void input to a datatype that represents the data you like to return... since tax is a double, then change the void with it....

Since that is in method main, make another method, put the operations there and call that method in method main... or you can construct a constructor and call it in method main...


Another way to catch the input is to use Scanner class ... this may fit your needs...

i hope it helps,
Sukatoa
Mar 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: inquirydog | last post by:
Hello- I, the inquirydog, would like to solicit suggestions for a new web page I am making: I am creating a simple website that will translate concepts between windows os's, Linux, and the...
3
by: Ralph H. Stoos Jr. | last post by:
All, I need suggestions for learning Java. I have purchased several books (Java Essentials, Beginning Java 2) and have tried to read and write code. Apparently, I am not easily able to read a...
10
by: Ruben Hoste | last post by:
Hello, I'm currently looking for more information on Genetic Algorithms and more specifficaly on how to program them in Java or C++. This is all concerning my thesis. A lot of general information...
10
by: Robert | last post by:
Where can i find a free web- based VC++ course? (also i've to dowanload it) I'm interested also in VB and C++ thanks, Robert
5
by: mr.iali | last post by:
Hi Everyone I would like to get into software developent using a programming language like c++, java or pl/sql for oracle. I have no idea where to start from. Which language is there more...
13
by: Andrew Bell | last post by:
I'm doing a uni course in the UK and one of my semesters is about programming. This is just going to be compilied and executed with no menu just using command promt (javac classfile.class) I am...
1
by: glenn123 | last post by:
Hi, i am just about out of time to produce a working jukebox which has to perform these functions: to play music files when a track is chosen from a list which when the user presses the change genre...
38
by: ifti_crazy | last post by:
I am VB6 programmer and wants to start new programming language but i am unable to deciced. i have read about Python, Ruby and Visual C++. but i want to go through with GUI based programming...
4
AmberJain
by: AmberJain | last post by:
I'm not a JAVA newbie..... I'm ABSOLUTE JAVA illiterate person.................. Recently, while I was planning to learn a new programming language, one of my friends advised me to learn JAVA....
15
by: colemanj4 | last post by:
Here is what I have so far, it loops while the PW is incorrect, or until cancel is selected. I want it to lock the tables for adds, deletes, and edits when cancel is selected, and if the PW is...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.