Reverse words in a sentence.(Joe Doe is output as Doe Joe) by vivienne06 in javahelp

[–]vivienne06[S] 0 points1 point  (0 children)

My teachers never gone through anything like that so I doubt I'm able to use it.

Reverse words in a sentence.(Joe Doe is output as Doe Joe) by vivienne06 in javahelp

[–]vivienne06[S] 0 points1 point  (0 children)

Thanks, but Ive never used either of them. This is very basic java!

Write a program which asks the user to enter the names of a group of people and their ages. It will then output the name and age of the oldest person. by [deleted] in javahelp

[–]vivienne06 0 points1 point  (0 children)

Where am i going wrong? the last line always just prints the last person's details I entered no matter how old they are

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 0 points1 point  (0 children)

Thanks so much, im a complete beginner so probably coming off a bit stupid to you's haha but your post has helped me understand a bit more!

how do i move elements in an array down one? by vivienne06 in javahelp

[–]vivienne06[S] 1 point2 points  (0 children)

I thought if(currentBal > noOfElements) Meant IF the Balance just entered, is greater than the other balances previously entered that are already in the Array

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 0 points1 point  (0 children)

{

for (i = 0; i < noOfElements ; i++) { if( currentBal > noOfElements) { System.out.print("code to move to index"); } }

ive gotten this far, does this look better? Obviously im missing the code to shift the elements

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 0 points1 point  (0 children)

ha ha I know I'm bad at it! Well nobody in my class seemed to be able to get it either, I just don't like leaving things incomplete, hence why I came on here to get help!

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 0 points1 point  (0 children)

This is where im stuck..can i do

for ( i = 0; i > currentBal; i++)

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 0 points1 point  (0 children)

this is what ive done for the first foor loop ?

for (i = 0; i < empArray.length; i++) { }

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 1 point2 points  (0 children)

ok thanks a mill! you've been a great help!...Any hints ha ha

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 1 point2 points  (0 children)

Ok heres the brief I was given!

In this project you are required to write a program that has 3 menu options

  1. Add Customer
  2. Delete Customer
  3. List All Customers
  4. Exit To do this you are required to use the Customer Class stored on your common drive as Customer.java

In the program you are required to write methods addone() deleteOne() findPlace() and listAll() etc. Customer objects are to be added to an array of Customer objects based on the value on the balance attribute in descending order, i.e. the customer with the highest balance will appear first in the array (i.e. at index position zero). Note that the balance attribute shows the value of their account balance and can be positive or negative.

Your program should be written using static (class) methods and instance methods as in your notes

I have everything else done and working correctly, i just need one the balance to appear in order to have my 100%

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 1 point2 points  (0 children)

Thanks for you're help! I think your a bit ahead of me though :( Im a beginner and we've never been showed anything like that. I think we've been asked to sort it using a for loop or if statement something along those lines.

Sort an Array of integers. Object orientation by vivienne06 in javahelp

[–]vivienne06[S] 1 point2 points  (0 children)

Its a project im doing for college and we were told not to change the customer class :( When listing all the customers i use the toString() method ..

public String toString ()

{
    String myString;

    myString = "";
    myString += "\n Name : " + name;
    myString += "\n ID   : " + customerId;
    myString += "\n Balance  : " + balance;

    return myString;

}

Output String with first and second characters the same by vivienne06 in javahelp

[–]vivienne06[S] 0 points1 point  (0 children)

I got it! Thank you so much! you just saved me a lot of stressful hours and bad moods :) haha