473,386 Members | 1,715 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,386 software developers and data experts.

Help urgently please.

I need help with these two question..has any one got idea for these two question..

Question 1:
I need to write an application that accepts a user’s password from the keyboard. When the entered password is less than six characters, more than ten characters, or doesn’t contain at least one letter and one digit, prompt the user again. When the user’s entry meets all the password requirements, prompt the user to re-enter the password, and do not let the user continue until the second password matches the first one.


Question 2:
I have been asked to write a Java application that will calculate an estimated tax for a tax payer, based on keyboard responses. This application will be used by taxpayers to calculate their personal tax liability.

The TaxReturn class contains field for taxpayer’s Social Security Number, surname, first name street address, city, post code, annual income, marital status, and tax liability. Include a constructor that requires arguments that provide value for all of the fields other than the tax liability based on annual income and marital status:

Single Married
Income
0 - 15000 5% 5%
15001- 25000 15% 10%
25001 – 40000 25% 20%
40001 Over 35% 30%

Create an application that prompts a user for the data needed to create a tax return display that contains details of the taxpayer in a readable presentable format along with their tax liability and the date.

Your application should make the following validations
 The SSN should be in the right format, i.e 9 characters, the first two and the last one are letters, the rest are numbers.
 The Post code should not be more than 7 characters, the first two are letters the third is a number and the rest doesn’t matter (for the sake of this exercise)
 Maritial status cannot accept any other character than m,M,s,S
 And of course the annual income cannot be negative.
Dec 6 '06 #1
1 2550
DeMan
1,806 1GB
It would help if you posted code excerpts to show progress.....

1) I am going to assume there is no requisite to mask at this stage, I am also goind to assume that you understand the basic Java language, so the problem is not so much with the input and length checking it is with the verifying a character and an int are there.....

Create an ArrayList (charArrayList) with all (upppercase & lowercase) characters.
Create another ArrayList i(intArrayList) with all the integers in it.

Create a Set (mySet)and add (individually) all the characters from your string into it (but keep the string (passString) too).

then:
Expand|Select|Wrap|Line Numbers
  1. tempSet=mySet.clone() //make a copy of this set
  2. tempSet.retainAll(charArrayList) //get rid of everything that is not an alphabetic char
  3. mySet.retainAll(intArrayList) //get rid of everything that is not an int
  4.  
  5. if(mySet.size()>0 && tempSet.size()>0)
  6. {
  7.   //myString is good (assuming you ested lengths before)
  8. }
  9. else
  10. {
  11.   //myString is not so good
  12. }
  13.  
Then, seeing as you atored the String earlier, loop until the user enters it again



2) I leave it to you to implement the TaxReturn class (there are many resources around to help you)

You can implement a class containing methods isAlpa and isNum (which might help you make the ealier code much simpler) and use this to test the elements of the SSN String

This will also help you verify the Post Code

Marital status should be trivial to implement

income check should be trivial.





If you are still having trouble, post code to show progress.....
Dec 6 '06 #2

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

Similar topics

1
by: Zeeshan | last post by:
Hi Everybody, I want to search the filename recursively for "this is the code original" using linux command grep or ls or any other Result should be as follows: FilenamePath and Linenumber in...
0
by: Kamliesh Nadar | last post by:
Hi I am developing a software using VB.NET I am facing following problems - 1. Though I have placed the NotifyIcon control on the window service application, after starting the service I am...
1
by: Dhiraj | last post by:
hello, everybody, this is Dhiraj here. I need help urgently, as i am getting error on my web page. The error is "Microsoft JET Database Engine error '80004005'" whenever i want to open links of...
5
by: el prinCipante | last post by:
I'm getting tired of the following error message. Compiler Error message : Error: Need explicit cast to convert from: float to: float * I am trying to use a routine from the Numerical Recipes...
1
by: anil | last post by:
hello all i am anil kumar, pursuing master's degree in Computer applications . now i have got some opensource project. that is related to USB sniffing. tha t is snoopypro. Actalluy this is...
0
by: Calvin KD | last post by:
Hi everyone, I need help urgently. I have a C#.Net app which uses cookies for state management (since we've gone away from Session for fear of webfarm and we haven't found the need for SQL Server...
0
by: Calvin KD | last post by:
Hi everyone, I need help urgently. I have a C#.Net app which uses cookies for state management. Everything has been going fine until recently we've expanded the app and a few more screens were...
4
by: Joonshik Kim | last post by:
I was trying to define 3d array with pointer to pointer. I wrote like following. int ***d; nx = 3; ny = 5; nz = 4; d = (int ***)malloc((int) nx*sizeof(int **)); *d = (int **)malloc((int)...
1
by: pathakrajeev | last post by:
Hi I needed help urgently. Suppose I have file name like test12wehow.asp test11234r5wesow.asp,upppwenow.asp. one thing is common in all the files are "we". I want to read the file as...
1
by: janakivenk | last post by:
Hello, I am running Oracle 10g R2 in our office. I created the following procedure. It is suppose to access an xml file ( family.xml). The procedure is compiled and when I try to run it, i get the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.