I'm using Eclipse and even though I've done more challenging things than this I keep getting stuck no matter how hard I hammer away at it.

This is a package, so the end of the first part (Driver Class?) is really what I'm having trouble with. Comments are included in the code. Also including the second part/ class is included.

Any guidance, help, flashing light bulbs would be greatly appreciated.

package 6;

import java.util.Scanner;
import java.text.DecimalFormat;



/**
 * @author Me
 *

 */


public class testAccount {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String input;
		double balance = 0, InterestRate = 0;
		double interest, deposit, withdrawals;
		double totalInterest=0, totalDeposits=0, totalWithdrawals=0;
		int month=0;
		char repeat='Y';
		
	    Scanner keyboard = new Scanner(System.in);

		DecimalFormat degrees = new DecimalFormat("#,###.00"); 
		
		System.out.println("What is your account's starting balance?");
	    balance= keyboard.nextDouble();
		
		
		
	     System.out.println("What is your annual interest rate?");
		 InterestRate= keyboard.nextDouble();
		
		
		SavingsAccount account= new SavingsAccount (balance, InterestRate);
		interest=account.MonthlyInterestRate(InterestRate);
		balance=account.calculateInterest(balance);
		//me testing to see If I can at least get the right balance but
		///Something is wrong with my decimal formatter, 
	    //keeps adding two 00's when I tested it
	     System.out.println("Your balance is is" +degrees.format(balance));

	   //How do I step into this Loop?

		while ( repeat =='Y'|| repeat =='y');
		{
			month++;
			System.out.println("What are your deposits?");
			deposit=keyboard.nextDouble();
		     account.deposit(deposit);
		     System.out.println( "your deposits" +deposit);
		     System.out.println("balance" +balance);
			System.out.println("What are your withdrawals?");
			withdrawals=keyboard.nextDouble();
		     account.withdraw(withdrawals);
			//Around here I'm supposed to be using the Accumulators to set keep count of
		     //totalwithdrawals,totaldeposits etc.
			
			System.out.println("Calculate Month" + (month +1) + "Y/N .");
			repeat=keyboard.nextLine().charAt(0);
		}
	
		System.exit(0);
	}

}

and this is what it links to
I'm pretty sure (92% at least)most of it is correct

package 6;

/**
The BankAccount class simulates a bank account.
*/

public class BankAccount
{
private double balance;      // Account balance
private double annualinterestrate;
/**
   This constructor sets the starting balance
   at 0.0.
 * @param input2 
 * @param input 
*/

public BankAccount()
{
   balance = 0.0;
   annualinterestrate=0.0;
}

/**
   This constructor sets the starting balance
   to the value passed as an argument.
   @param startBalance The starting balance.
*/

public BankAccount(double startBalance, double InterestRate)
{
   balance = startBalance;
   annualinterestrate=InterestRate;
}
public double MonthlyInterestRate(double annualrate)
{
	annualinterestrate=annualrate;
	return annualrate /12;
}
//public void MonthlyInterestRate(String input2) {
	// TODO Auto-generated method stub
	//annualinterestrate= Double.parseDouble(input2);
//}
public double calculateInterest(double annualrate)
{
// add code to calculate interest
	
	balance += annualrate * balance;
	return balance;
}
/**
   This constructor sets the starting balance
   to the value in the String argument.
   @param str The starting balance, as a String.
*/

public BankAccount(String str )
{
   balance = Double.parseDouble(str);
}

/**
   The deposit method makes a deposit into
   the account.
   @param amount The amount to add to the
                 balance field.
*/

public void deposit(double amount)
{
   balance += amount;
}

/**
   The deposit method makes a deposit into
   the account.
   @param str The amount to add to the
              balance field, as a String.
*/


//This is 
public void deposit(String str)
{
   balance += Double.parseDouble(str);
}

/**
   The withdraw method withdraws an amount
   from the account.
   @param amount The amount to subtract from
                 the balance field.
*/

public void withdraw(double amount)
{
   balance -= amount;
}

/**
   The withdraw method withdraws an amount
   from the account.
   @param str The amount to subtract from
              the balance field, as a String.
*/

public void withdraw(String str)
{
   balance -= Double.parseDouble(str);
}}

/**
   The setBalance method sets the account balance.
   @param b The value to store in the balance field.
*/

Hope these points helps you

1] There is nothing wrong with the formatter. It is only formatting the output for the value in 'balance'. Check whether the formula for calculating balance is correct or not

2] For the part

//How do I step into this Loop?
 
while ( repeat =='Y'|| repeat =='y');

remove the semicolon. Be careful with semicolons for loops and conditional statements

for the part

//How do I step into this Loop?
 
while ( repeat =='Y'|| repeat =='y');

i believe that using

while ( repeat.equalsCaseInsensitive("Y")) {

}

will enable you to enter the loop... iirc, you need to use .equals() to compare two strings, not the == operator.

TJ

Actually 'repeat' is of type char hence

while ( repeat.equalsCaseInsensitive("Y")) {
 
}

wont work in this case

You are processing the input with the account object, which is defined as a SavingsAccount class. The subclass containing the deposit and withdrawal methods is named as Bank Account! Perhaps when you decided to rename one you should have renamed both!
To accumulate the totals you seem only to need

totalDeposits+=deposit;

and for totalwithdrawals.

ah okay nevermind then..

Design and implement a small system in Java for representing different geometrical shapes.

Your system should be able to handle the following shapes: triangle, rectangle, square, and circle.

Each shape has a name and colour, as well as appropriate dimensions.

An example of dimensions you can use to describe a shape is:

• Triangle – the lengths of the three sides
• Rectangle – width and height
• Square – width of the side
• Circle – radius

Each shape also has an area. Your program should be able to display details for each shape on the screen.

Your program should demonstrate the use of aggregation, polymorphism and inheritance where appropriate.

Write a menu-driven system that will allow you to display details of a bag of shapes and to modify them. Initially you should create several random shapes. Your system should offer options to select which shape you want to modify and should allow you to input new values for the attributes you wish to change.


DELIVERABLES

You should submit the Java code (source code and classes) for your program, as well as a short documentation of your system.

The documentation should discuss and justify the decisions taken when designing the system – e.g. the attributes and methods included for each shape, clearly identifying (and motivating the need for) aggregation, polymorphism and inheritance where appropriate.

The documentation should also describe the behaviour of your system (the different options) and should include few sample dialogs.
This is a sample output of what your system should be able to do.
There is no need to recreate the exact output as the listed below.


-------------------------------------------------------------------------------------------------
Welcome to my shapes program. We will start by generating some random shapes.

How many random shapes do you want to generate?: 2

Generating shapes…
Creating square. Please enter width: 3
Creating triangle. Please enter lengths for the tree sides: 4 6 4

****************************************************
Please choose one of the following options:
1. Show shapes details
2. Modify shape dimensions
3. Modify shape colour
4. Exit
****************************************************
Enter your choice: 1

Printing shapes details:

Shape 1
Name: Square
Colour: Blue
Area: 9.0
… [other appropriate attributes]

Shape 2
Name: Triangle
Colour: Pink
Area: 20.0
… [other appropriate attributes]


****************************************************
Please choose one of the following options:
1. Show shapes details
2. Modify shape dimensions
3. Modify shape colour
4. Exit
****************************************************
Enter your choice: 2
Please enter the id of the shape you wish to modify: 1
Please enter new width: 4


****************************************************
Please choose one of the following options:
1. Show shapes details
2. Modify shape dimensions
3. Modify shape colour
4. Exit
****************************************************
Enter your choice: 1

Printing shapes details:

Shape 1
Name: Square
Colour: Blue
Area: 16.0
… [other appropriate attributes]

Shape 2
Name: Triangle
Colour: Pink
Area: 20.0
… [other appropriate attributes]

[… and so on. The program terminates when the user enters 4 as an option]

Don't hijack other's people threads mzashi hassan, and do your OWN homework. We will not do it for you.

CONSOLE

package shapes;

public class Console{
    /**
    * print a prompt on the console but don't print a newline
    * @param prompt the prompt string to display
    */

   public static void printPrompt(String prompt)
   {  System.out.print(prompt + " ");
      System.out.flush();
   }

   /**
    * read a string from the console. The string is
    * terminated by a newline
    * @return the input string (without the newline)
    */

   public static String readString()
   {  int ch;
      String r = "";
      boolean done = false;
      while (!done)
      {  try
         {  ch = System.in.read();
            if (ch < 0 || (char)ch == '\n')
               done = true;
            else if ((char)ch != '\r') // weird--it used to do \r\n translation
               r = r + (char) ch;
         }
         catch(java.io.IOException e)
         {  done = true;
         }
      }
      return r;
   }

   /**
    * read a string from the console. The string is
    * terminated by a newline
    * @param prompt the prompt string to display
    * @return the input string (without the newline)
    */

   public static String readString(String prompt)
   {  printPrompt(prompt);
      return readString();
   }

   /**
    * read a word from the console. The word is
    * any set of characters terminated by whitespace
    * @return the 'word' entered
    */

   public static String readWord()
   {  int ch;
      String r = "";
      boolean done = false;
      while (!done)
      {  try
         {  ch = System.in.read();
            if (ch < 0
               || java.lang.Character.isWhitespace((char)ch))
               done = true;
            else
               r = r + (char) ch;
         }
         catch(java.io.IOException e)
         {  done = true;
         }
      }
      return r;
   }

   /**
    * read an integer from the console. The input is
    * terminated by a newline
    * @param prompt the prompt string to display
    * @return the input value as an int
    * @exception NumberFormatException if bad input
    */

   public static int readInt(String prompt)
   {  while(true)
      {  printPrompt(prompt);
         try
         {  return Integer.valueOf
               (readString().trim()).intValue();
         } catch(NumberFormatException e)
         {  System.out.println
               ("Not an integer. Please try again!");
         }
      }
   }

   public static int readInt()
      {  while(true)
         {  //printPrompt(prompt);
            try
            {  return Integer.valueOf
                  (readString().trim()).intValue();
            } catch(NumberFormatException e)
            {  System.out.println
                  ("Not an integer. Please try again!");
            }
         }
   }

   /**
    * read a floating point number from the console.
    * The input is terminated by a newline
    * @param prompt the prompt string to display
    * @return the input value as a double
    * @exception NumberFormatException if bad input
    */

   public static double readDouble(String prompt)
   {  while(true)
      {  printPrompt(prompt);
         try
         {  return Double.valueOf
(readString().trim()).doubleVal

CIRCLE

*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package shapes;

/**
 *
 * @author student
 */
class Circle extends Shape {
  protected double Radius;
 public Circle(double Radius,String name,String colour){
    super(name,colour);
    this.Radius=Radius;
}
public void SetRadius(double newRadius){
    Radius=newRadius; 
}
public Double GetRadius(){
    return RadiuS
}
double Area=(3.14 * (Radius)*(Radius));
public double Area(){
    return Area;
}
}

RECTANGLE

*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package shapes;

/**
 *
 * @author student
 */
class Rectangle extends Shape {
  protected double length;
  protected double width;
 public Rectangle(double length,double width,String name,String colour){
    super(name,colour);
    this.length=length;
    this.width=width;
}
public void Setlength(double newlength){
    length=newlength; 
}
public double Getlength(){
    return length;
}
public void Setwidth(double newwidth){
    width=newwidth;
}
public double Getwidth(){
    return width;
}
double Area=(width*length);
public double Area(){
    return Area;
}

}

TRIANGLE

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package shapes;

/**
 *
 * @author student
 */
class Triangle extends Shape {
  protected double length;
  protected double width;
  protected double base;
 public Triangle(double length,double width,double base,String name,String colour){
    super(name,colour);
    this.length=length;
    this.width=width;
    this.base=base;
}
public void Setlength(double newlength){
    length=newlength; 
}
public double Getlength(){
    return length;
}
public void Setwidth(double newwidth){
    width=newwidth;
}
public double Getwidth(){
    return width;
}
public void Setbase(double newbase){
    base=newbase;
}
public double Getbase(){
    return base;
}
double Area=(0.5 * (base*length));
public double Area(){
    return Area;
}
}

SQUARE

*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package shapes;

/**
 *
 * @author student
 */
class Square extends Shape {
  protected double length;
 public Square(double l,String name,String colour){
    super(name,colour);
    length=l;
}
public void Setlength(double newlength){
    length=newlength; 
}
public double Getlength(){
    return length;
}
double Area=length*length;
public double Area(){
    return Area;
}
}

MAIN

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package shapes;

/**
 *
 * @author student
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    }

}

SHAPES

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package shapes;

/**
 *
 * @author student
 */
public class Shape {
    protected String name;
    protected String colour;
public Shape(String name,String colour){
    this.name=name;
    this.colour=colour;
}
public void Set name(String name){
    this.name=name;
}
public String Get name(){
return name;
}
public void Setcolour(String colour){
   this.colour= colour;
}
public String Getcolour(){
    return colour;
}
}

SHAPE 2

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package shapes;

/**
 *
 * @author student
 */
public class Shape {
    protected String name;
    protected String colour;
public Shape(String name,String colour){
    this.name=name;
    this.colour=colour;
}
public void Setname(String name){
    this.name=name;
}
public String Getname(){
return name;
}
public void Setcolour(String colour){
   this.colour= colour;
}
public String Getcolour(){
    return colour;
}
}

SQUARE

*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package shapes;

/**
 *
 * @author student
 */
class Square extends Shape {
  protected double length;
 public Square(double l,String name,String colour){
    super(name,colour);
    length=l;
}
public void Setlength(double newlength){
    length=newlength; 
}
public double Getlength(){
    return length;
}
double Area=length*length;
public double Area(){
    return Area;
}
}

kachiraly mully

commented: Use code tags and don't give away answers. -1

This forum is not for doing other's people homework. The rest of us didn't give the solution for a reason. We are not here to do it for them.

Ok you know the answer. So what? With your post you are implying that you are the smart one who posted the solution to a 1 month-old thread, which I find insulting for the rest,
And we are the stupid for not wanting to do someone else's homework so he can get all the credit without trying.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.