Assignment help

This is a discussion on Assignment help within the C# Programming forums, part of the General Programming Boards category; Hey all im new to this board and i dont know if im posting it in the right thread but ...

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    3

    Question Assignment help

    Hey all im new to this board and i dont know if im posting it in the right thread but i need your help with the following

    1. Write a program to store any 2 values in two variables a,b and interchange their values and display them.
    2. Write a program to calculate the square and cube of a number passed to a method. Display the number,square and cube.
    3. Write a program to accept a value m and hence display it in reverse.
    4. Write a program to accept any number and display all its factors.
    5. Write a program to accept any day of week and display it in words.

    I have to do this in a programme called Blu J -- i need to write in this format...

    class two
    {
    public static void main (String args [])
    {
    int a=9;int cube;int sq;
    sq=a*a;
    cube=a*a*a;
    System.out.println("The number is" +a);
    System.out.println("The square of the number is" = sq);
    System.out.println("The cube of the number is" = cube);
    }
    }

    can somebody help me out please???
    Any help is appreciated...

    thanks all

  2. #2
    Registered User
    Join Date
    Jan 2011
    Posts
    3
    For question 3 i tried this


    class three
    {
    void calc (int o)
    {
    System.out.println("Thr original number is" + o);
    int r=o;
    r=o % 10;
    System.out.println("The reverse number is" + r);
    r=o/10;
    r=r%10;
    System.out.println(r);
    r=o/100;
    System.out.println(r);
    }
    public static void main(Strings args[]);
    {
    three obj=new three ();
    obj.calc(47);
    }
    }


    when i press COMPILE it says "cannot find symbol - class Strings"

    what do i do???

  3. #3
    Registered User
    Join Date
    Jan 2011
    Posts
    3
    For question TWO i tried this


    class two
    {
    public static void main (String args [])
    {
    int a=9;int cube;int sq;
    sq=a*a;
    cube=a*a*a;
    System.out.println("The number is" +a);
    System.out.println("The square of the number is" = sq);
    System.out.println("The cube of the number is" = cube);
    }
    }

    when i press COMPILE it says " unexpected type Required - Variable , Found - Value"

    help???

  4. #4
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    Quote Originally Posted by Rastafarian View Post
    For question TWO i tried this


    Code:
    class two
    {
    public static void main (String args [])
    {
    int a=9;int cube;int sq;
    sq=a*a;
    cube=a*a*a;
    System.out.println("The number is" +a);
    System.out.println("The square of the number is" = sq);
    System.out.println("The cube of the number is" = cube);
    }
    }
    when i press COMPILE it says " unexpected type Required - Variable , Found - Value"

    help???
    2. Write a program to calculate the square and cube of a number passed to a method. Display the number,square and cube.
    1. You missed this significant part of the question. The number must be passed to a method.
    2. You used = instead of + when displaying the final two lines of text.
    3. This looks suspiciously like Java, not C#.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu
    By Krush in forum C Programming
    Replies: 17
    Last Post: 09-01-2009, 02:34 AM
  2. Assignment Operator, Memory and Scope
    By SevenThunders in forum C++ Programming
    Replies: 47
    Last Post: 03-31-2008, 06:22 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Help with a pretty big C++ assignment
    By wakestudent988 in forum C++ Programming
    Replies: 1
    Last Post: 10-30-2006, 08:46 PM
  5. Replies: 1
    Last Post: 10-27-2006, 01:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21