Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: help me with a code, whats wrong?

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post help me with a code, whats wrong?

    import java.util.*;
    public class Local {
    public static void main(Strings[] args){
    Scanner reader;
    String address, typepay, credit, cash;
    int space,localcost, totalinstallation, months, paint=100;
    double monthlycost, interest, painting, finalcost;
    public void initialize(){
    reader=new Scanner(System.in);
    System.out.println("Type your address and construction company");
    address=reader.nextLine();
    System.out.println("What's the space of your local?");
    space=reader.nextInt();
    System.out.println("What's the cost of your local?");
    localcost=reader.nextInt();
    System.out.println("Choose a form of payment. Credit or Cash");
    typepay=reader.nextLine();
    System.out.println("How many months are you willing to pay?");
    months=reader.nextInt();
    }
    public void calculate(){
    totalinstallation=(space*localcost) + 2000;
    }
    public void credits(){
    if(typepay==credit) {
    monthlycost=(localcost/months)*(1.15);
    } else if (typepay==cash) {
    monthlycost=localcost;
    }
    }
    public void calculateinterest(){
    if(typepay==credit){
    interest=localcost*(1.15);
    } else if (typepay==cash) {
    interest=localcost;
    }
    }

    public void costpaint(){
    paintingpaint*space)*(1.15)) + 2000;
    }

    public void calculatefinal(){
    finalcost=interest + totalinstallation + painting;
    }

    public void print(){
    System.out.println("Your address is " + address);
    System.out.println("The space of your local is " + space);
    System.out.println("The cost of your local is " + localcost);
    System.out.println("The cost of your local with installations is " + totalinstallation);
    System.out.println("You chose as way of payment: " + typepay);
    System.out.println("Your monthly cost is: " + monthlycost);
    System.out.println("Your cost with interest is: " + interest);
    System.out.println("The service of the paint will cost you: " + painting + " including the workforce");
    System.out.println("The final cost of your local is: " + finalcost);
    }

    public static void main(String [] args) {
    Local local1;
    local1=new Local();
    local1.initialize();
    local1.calculate();
    local1.credits();
    local1.calculateinterest();
    local1.costpaint();
    local1.calculatefinal();
    local1.print();
    }
    }


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: help me with a code, whats wrong?

    Hi and welcome
    Please read the sticky at the top of the forum, found here, and the announcements on this page.

    If you still have a problem with the code, please include code tags and a question.
    Moved from member introductions.

  3. #3
    Member
    Join Date
    Jul 2012
    Posts
    71
    Thanks
    1
    Thanked 7 Times in 7 Posts

    Default Re: help me with a code, whats wrong?

    what problems are u experiencing exactly?

Similar Threads

  1. whats wrong with my code.
    By jove in forum Object Oriented Programming
    Replies: 3
    Last Post: July 30th, 2011, 11:45 PM
  2. Whats wrong with my code!!
    By nitwit3 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 22nd, 2011, 11:45 AM
  3. Whats Wrong with this code?
    By whattheeff in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 9th, 2011, 10:59 PM
  4. Whats wrong with my code?
    By whattheeff in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 4th, 2011, 05:34 PM
  5. Whats wrong with my code?
    By mlan in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 27th, 2010, 01:42 PM