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 2 of 2

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 262 Times in 231 Posts

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

    Thread closed as duplicate of help me with a code, whats wrong?

Similar Threads

  1. Can someone see whats wrong with my code, please?
    By DJBENZ10 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 11th, 2012, 08:54 PM
  2. Whats wrong with my code??
    By mozza in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 14th, 2012, 10:37 AM
  3. Whats wrong with my code?
    By Bryan29 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: October 5th, 2011, 09:12 AM
  4. whats wrong with my code.
    By jove in forum Object Oriented Programming
    Replies: 3
    Last Post: July 30th, 2011, 11:45 PM
  5. Whats Wrong with this code?
    By whattheeff in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 9th, 2011, 09:59 PM

Tags for this Thread