Docsity

Assignment 4 for Java Programming | COP 2250, Assignments of Javascript programming

Toggle sidebar
bg1
COP2250 – ASSIGNMENT 4
Due Tuesday, March 25th
Instructions:
• A signed statement stating that you have adhered to the collaboration policy for this class
and that what you are presenting is your own work.
• If you have received help from any source other than your class notes or textbook, please
cite the source at the appropriate place. This includes tutorships.
• The assignment should be typed and a stapled hardcopy of the same has to be submitted at
the beginning of the class.
• For programming assignments, submit a hardcopy of the pseudo code, code and the printout
of the output.
• The code should contain the following header:
/**
* Author: xyz
* Description: What the program is expected to do.
* Additional information about variables, parameters, etc
*/
Problems:
1. Using a loop, write a program that takes 10 integer values from the keyboard and outputs the
minimum value of all the values entered. [10 points]
2. Write a program that takes a value as an input from the keyboard and outputs the factorial of
that number; the factorial of an integer n is n*(n-1)*…*3*2*1. For instance, the factorial of 4
is 4*3*2*1, or 24. [15 points]
3. Modify the program that you wrote for Problem 1 in the Assignment 3. This time, the
program will not read a web address but an e-mail address (for instance, [email protected])
from the keyboard. The user’s input must contain an @ character. If it does not, then your
program should keep prompting the user for an input. When the user types in a valid e-mail
address containing an @ character, the program should output whether the e-mail address is
for a government agency, a university, a business, an organization, or another entity, as you
did in the previous assignment. [15 points]
4. Write a class encapsulating the concept of a course, assuming a course has the following
attributes: a code (for instance, COP2250), a description, and a number of credits (for
instance, 3). Include a constructor, the accessors and mutators, and methods toString and
equals. Write a client class to test all the methods in your class. [20 points]
pf2

Partial preview of the text

Download Assignment 4 for Java Programming | COP 2250 and more Assignments Javascript programming in PDF only on Docsity!

COP2250 – ASSIGNMENT 4

Due Tuesday, March 25th

Instructions:

  • A signed statement stating that you have adhered to the collaboration policy for this class and that what you are presenting is your own work.
  • If you have received help from any source other than your class notes or textbook, please cite the source at the appropriate place. This includes tutorships.
  • The assignment should be typed and a stapled hardcopy of the same has to be submitted at the beginning of the class.
  • For programming assignments, submit a hardcopy of the pseudo code, code and the printout of the output.
  • The code should contain the following header: /** * Author: xyz * Description: What the program is expected to do. * Additional information about variables, parameters, etc */

Problems:

  1. Using a loop, write a program that takes 10 integer values from the keyboard and outputs the minimum value of all the values entered. [10 points]
  2. Write a program that takes a value as an input from the keyboard and outputs the factorial of that number; the factorial of an integer n is n(n-1)…32*1. For instance, the factorial of 4 is 432*1, or 24. [15 points]
  3. Modify the program that you wrote for Problem 1 in the Assignment 3. This time, the program will not read a web address but an e-mail address (for instance, [email protected]) from the keyboard. The user’s input must contain an @ character. If it does not, then your program should keep prompting the user for an input. When the user types in a valid e-mail address containing an @ character, the program should output whether the e-mail address is for a government agency, a university, a business, an organization, or another entity, as you did in the previous assignment. [15 points]
  4. Write a class encapsulating the concept of a course, assuming a course has the following attributes: a code (for instance, COP2250), a description, and a number of credits (for instance, 3). Include a constructor, the accessors and mutators, and methods toString and equals. Write a client class to test all the methods in your class. [20 points]
  1. You coded the following definition for the class Grade :

3 public class Grade 4 { 5 private char letterGrade; 6 public Grade( char lg ) 7 { 8 letterGrade = lg; 9 } 10 public String toString() 11 { 12 return ( lg ); 13 } 14 }

When you compile, you get the following message:

Grade.java:12: cannot find symbol Symbol : variable lg Location: class Grade return lg; ^

1 error

Explain what the problem is and how to fix it. [10 points]