I need Ur help

I need Ur help

Page 1 of 1

5 Replies - 1365 Views - Last Post: 02 March 2010 - 01:03 PM Rate Topic: -----

#1 kotaic   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 1
  • Joined: 01-March 10

I need Ur help

Posted 01 March 2010 - 11:15 PM

can U help me plz..

Quiestion#1: Revision
Write a program to be used as a math tutor for a young student. The program should display a menu allowing the user to select addition, subtraction, multiplication or division. The final selection on the menu should allow the user to quit and exit the program. Each of operations, Addition, Subtraction, Multiplication and Division should be as separate method called from Main.
1. Display the menu-Accept user input on the operation to be performed
2. Generate 2 random numbers from 1-20
3. Display the numbers and accept the user answers from the keyboard on whether they perform addition, subtraction, multiplication or division
4. Compute the correct answer with your program. Compare the users answer to the answer you calculated in your program.
5. If the user enters the correct answer, display the message Congratulations..You are Correct
6. If the user enters the incorrect answer, display the message
Incorrect..The correct answer is...display the correct answer.
7. If the user selects an item not on the menu, display an error message and display the menu again.
8. After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program.
Sample Output:
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select one of the above operations: 1

2 + 4 = ?
Enter your answer: 6
Congratulations..You are Correct

1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select one of the above operations: 3

6 * 3 = ?
Enter your answer: 12
Incorrect..The correct answer is 18

1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select one of the above operations: 8
Invalid choice!! Please select from 1..5

1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select one of the above operations: 5

Bay..Bay :)

Quiestion#2: Classes and Objects
Modify class GradeBook as follows:
• Include a second string instance variable that represents the name of the course's instructor.
• Provide a set method and a get method to retrieve it.
• Modify the constructor to specify two parameters - one for the course and one for the instructor’s name.
• Modify method displaymessage such that it first outputs the welcome message and course name, then outputs "this course is presented by: "followed by the instructor’s name.
• Modify the test application to demonstrate the class's new capabilities.

Program Template:
// GradeBook.java
public class GradeBook
{
private String courseName; // course name for this GradeBook
/* write code to declare a second String instance variable */

// constructor initializes courseName with String supplied as argument
public GradeBook( String name )
{
courseName = name; // initializes courseName
} // end constructor
// method to set the course name
public void setCourseName( String name )
{
courseName = name; // store the course name
} // end method setCourseName
// method to retrieve the course name
public String getCourseName()
{
return courseName;
} // end method getCourseName
/* write code to declare a get and a set method for the instructor’s name */

// display a welcome message to the GradeBook user
public void displayMessage()
{
// this statement calls getCourseName to get the
// name of the course this GradeBook represents
System.out.printf( "Welcome to the grade book for\n%s!\n", getCourseName() );
/* write code to output the instructor’s name */

} // end method displayMessage
} // end class GradeBook

// GradeBookTest.java
public class GradeBookTest
{
// main method begins program execution
public static void main( String args[] )
{
// create GradeBook object
GradeBook gradeBook1 = new GradeBook( "CSC113 Java ProgrammingII!" );
gradeBook1.displayMessage(); // display welcome message
/* write code to change instructor’s name and output changes */

} // end main
} // end class GradeBookTest

Sample Output:

Welcome to the grade book for
CSC113 Java Programming_II!
This course is presented by: Entesar AlMosallam

Changing instructor name to Kholod AlSaleh

Welcome to the grade book for
CSC113 Java Programming_II!
This course is presented by: Kholod AlSaleh

Is This A Good Question/Topic? 0
  • +

Replies To: I need Ur help

#2 kotaic   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 1
  • Joined: 01-March 10

Re: I need Ur help

Posted 01 March 2010 - 11:18 PM

Quiestion#1: Revision
Write a program to be used as a math tutor for a young student. The program should display a menu allowing the user to select addition, subtraction, multiplication or division. The final selection on the menu should allow the user to quit and exit the program. Each of operations, Addition, Subtraction, Multiplication and Division should be as separate method called from Main.
1. Display the menu-Accept user input on the operation to be performed
2. Generate 2 random numbers from 1-20
3. Display the numbers and accept the user answers from the keyboard on whether they perform addition, subtraction, multiplication or division
4. Compute the correct answer with your program. Compare the users answer to the answer you calculated in your program.
5. If the user enters the correct answer, display the message Congratulations..You are Correct
6. If the user enters the incorrect answer, display the message
Incorrect..The correct answer is...display the correct answer.
7. If the user selects an item not on the menu, display an error message and display the menu again.
8. After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program.
Sample Output:
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select one of the above operations: 1

2 + 4 = ?
Enter your answer: 6
Congratulations..You are Correct

1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select one of the above operations: 3

6 * 3 = ?
Enter your answer: 12
Incorrect..The correct answer is 18

1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select one of the above operations: 8
Invalid choice!! Please select from 1..5

1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select one of the above operations: 5

Bay..Bay :)

Quiestion#2: Classes and Objects
Modify class GradeBook as follows:
• Include a second string instance variable that represents the name of the course's instructor.
• Provide a set method and a get method to retrieve it.
• Modify the constructor to specify two parameters - one for the course and one for the instructor’s name.
• Modify method displaymessage such that it first outputs the welcome message and course name, then outputs "this course is presented by: "followed by the instructor’s name.
• Modify the test application to demonstrate the class's new capabilities.

Program Template:
// GradeBook.java
public class GradeBook
{
private String courseName; // course name for this GradeBook
/* write code to declare a second String instance variable */

// constructor initializes courseName with String supplied as argument
public GradeBook( String name )
{
courseName = name; // initializes courseName
} // end constructor
// method to set the course name
public void setCourseName( String name )
{
courseName = name; // store the course name
} // end method setCourseName
// method to retrieve the course name
public String getCourseName()
{
return courseName;
} // end method getCourseName
/* write code to declare a get and a set method for the instructor’s name */

// display a welcome message to the GradeBook user
public void displayMessage()
{
// this statement calls getCourseName to get the
// name of the course this GradeBook represents
System.out.printf( "Welcome to the grade book for\n%s!\n", getCourseName() );
/* write code to output the instructor’s name */

} // end method displayMessage
} // end class GradeBook

// GradeBookTest.java
public class GradeBookTest
{
// main method begins program execution
public static void main( String args[] )
{
// create GradeBook object
GradeBook gradeBook1 = new GradeBook( "CSC113 Java ProgrammingII!" );
gradeBook1.displayMessage(); // display welcome message
/* write code to change instructor’s name and output changes */

} // end main
} // end class GradeBookTest

Sample Output:

Welcome to the grade book for
CSC113 Java Programming_II!
This course is presented by: Entesar AlMosallam

Changing instructor name to Kholod AlSaleh

Welcome to the grade book for
CSC113 Java Programming_II!
This course is presented by: Kholod AlSaleh
Was This Post Helpful? -1
  • +
  • -

#3 zim1985   User is offline

  • Grand Inquisitor
  • member icon

Reputation: 75
  • View blog
  • Posts: 568
  • Joined: 19-February 10

Re: I need Ur help

Posted 02 March 2010 - 12:17 AM

Please put your code in the code tags

Also indent your code so we can help you.

Anyway, it looks like you have a bunch of pseudo-code here. Make sure you implement each method as it is described in the directions.

This post has been edited by zim1985: 02 March 2010 - 12:18 AM

Was This Post Helpful? 0
  • +
  • -

#4 Simple_Condolences   User is offline

  • D.I.C Head

Reputation: 11
  • View blog
  • Posts: 180
  • Joined: 10-January 10

Re: I need Ur help

Posted 02 March 2010 - 07:29 AM

:code:

Help us help you! Thanks!

- Zach
Was This Post Helpful? 0
  • +
  • -

#5 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12800
  • View blog
  • Posts: 45,992
  • Joined: 27-December 08

Re: I need Ur help

Posted 02 March 2010 - 07:40 AM

In addition to using code tags like so:
:code:
And indenting your code, please describe your errors specifically so we can help you.
Was This Post Helpful? 0
  • +
  • -

#6 xor-logic   User is offline

  • HAL9000 was an Apple product
  • member icon

Reputation: 128
  • View blog
  • Posts: 767
  • Joined: 04-February 10

Re: I need Ur help

Posted 02 March 2010 - 01:03 PM

I wasn't going to answer, but your having posted the same text twice within five minutes changed my mind... >.<

In any case, did you have a specific question you wanted help with, or were you expecting one of us to do your homework for you (not gonna happen)? You haven't posted any code that you created, the only thing you've posted is a skeleton program provided with your assignment. So:

[rules][/rules]

Edit: removed : code : smiley as it's included in the rules.

This post has been edited by xor-logic: 02 March 2010 - 01:04 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1