kikiskia's Profile
Reputation: 0
Apprentice
- Group:
- Members
- Active Posts:
- 28 (0.05 per day)
- Joined:
- 10-September 11
- Profile Views:
- 160
- Last Active:
Oct 02 2012 05:59 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Java Class Coding...several classes
Posted 24 Sep 2011
tlhIn`toq, on 24 September 2011 - 11:03 AM, said:I will make this suggestion:
Don't get the bad habit now of naming things so inaccurately.
Quote
Student database[]= new Student[2];
It's not a database. Not even close. Its just an array of Student Objects. So name it such.
Student StudentArray[] = new Student[2];
Later when you upgrade this project to actually using a database you won't find yourself in the awkward position of having something *named* database and asking yourself..Quote
"Well I have something named database so what should I name my actual database? Hmm... About about 'Array'? That won't be confusing at all"
kikiskia, on 24 September 2011 - 11:58 AM, said:... and I dont know who I am doing.
hahah I am sorry I meant to write What I am doing....nice sense of humor!
Ah..... The youthful days of college when we didn't even know who we were doing. Enjoy it while it lasts. As you get older you at least have to ask their names and pretend like you want to get to know them first. -
In Topic: Java Class Coding...several classes
Posted 24 Sep 2011
tlhIn`toq, on 24 September 2011 - 10:55 AM, said:Does it throw an error?
Does it put the values in the right variables?
You don't need us to tell you if it works or fails. You should be able to see that by looking at the values of the variables.
There are 100 ways to do anything in the programming world. If it works, it works. If you ask 100 coders how they would do something you will get 100 different answers. That doesn't make any one of them more right or wrong than the other. Just different.
You might as well be asking "Am I washing these dishes the *right* way?", or "If I wash these dishes this other way will that work?"
hahah yea in my Student Class it wont work...I am so lost in this assignment and I will go in monday to talk to the head department because I emailed my professor three days ago and got no response and his accent is too heavy to be able to understand him in person. I have been dealong with this code for hours and I dont know who I am doing. This is my first programming class hence I do not have enough programming language to complete this task ! -
In Topic: Java Class Coding...several classes
Posted 24 Sep 2011
can I also do it this way????
public class Person { private String name; private int socialSecurity; private int phoneNumber ; private int age; private String gender; private int address; public Person(String incomingName, int incomingSoS, int incomingPhone, int incomingAge, String incomingGender, int incomingAddress) { name=incomingName; socialSecurity=incomingSoS; phoneNumber= incomingPhone; age=incomingAge; gender= incomingGender; address=incomingAddress; } public String getName() { return name; } public void setName(String newName) { name=newName; } public int getSocialSecurity() { return socialSecurity; } public void setSocialSecurity(int newSocialSecurity) { socialSecurity=newSocialSecurity; } public int getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(int newPhoneNumber) { phoneNumber=newPhoneNumber; } public int getAge() { return age; } public void setAge(int newAge) { age=newAge; } public String getGender() { return gender; } public void setGender(String newGender) { gender=newGender; } public int getaddress() { return address; } public void setAddress(int newAddress) { address=newAddress; } public String toString() { return getName() + ""+ socialSecurity+ phoneNumber + age+ gender+ address; } }
public class Student { public static void main(String[] args) { Student database[]= new Student[2]; database[0]= new Student("Name: George Washington" + "Social Security #: 999-53-4072" + "Age: 56" + "Gender Male" + "Address: 466 9th Av" + "Phone: 162-116-6540" + "GPA: 4.00" + "Major: Computer Science" + "Year of Grad.: 2007 "); database[1]= new Student("Name: John Adams" + "Social Security #: 255-60-2609" + "Age: 20" + "Gender Male" + "Address: 880 2nd Av" + "Phone: 480=801-1174" + "GPA: 3.59" + "Major: Math" + "Year of Grad.: 2005 "); } } -
In Topic: must take user input and reverse each sentence that they write
Posted 18 Sep 2011
ok well I redid my entir code and got it to work,, but for some reson it will not reverse the sentences. it is supposed to ask the user how many sentences they want to input and the user inputs a number is than asked to input their sentences ..then it would be like lets say they input I love cats...well then my code is supposed to display Line1: cats I love... and so forth...they only problem I have is reversing the sentences. I did earlier but than changed something and now I dont know why its stuck!
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner keyboard= new Scanner(System.in); System.out.print("How many lines would you like to enter : "); int answer = keyboard.nextInt(); String s=null; String temp[]; for(int i=0;i<= answer;i++) { System.out.println("Enter your line Please"); s = keyboard.nextLine(); temp=s.split(" "); for (int count=1; count <= answer; count++) { System.out.print("Line" + count + " :" ); String s1 = keyboard.nextLine(); System.out.println(s1); } for(int j=(temp.length-1);j>=0;j--){ System.out.println(temp[j]); }}}} -
In Topic: must take user input and reverse each sentence that they write
Posted 17 Sep 2011
ok well i saw that we can use the deliminter to split sentences...umm this is what i got....im so confused.. I put the sentences in a String and then tried to use the split string thing and got lost once again....
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner keyboard= new Scanner(System.in); System.out.println ("How many sentences are you inputing?"); int answer=keyboard.nextInt(); String[] sentences = new String[answer]; System.out.println("Please enter your sentences"); String userSentences=keyboard.next(); delimiter = "\\."; for(int i = 0; i < answer.length; ++i) { String temp = userSentences.split(delimiter); } for (int count=1; count <=answer; count++) { System.out.println("Line" + count + " :" + sentences[count] ); } } }
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Click here to e-mail me
Friends
kikiskia hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
kikiskia has no profile comments yet. Why not say hello?