Question: Java

Ads

 
 
 

Share on Google+Share on Google+

Priti Saba
Java
0 Answer(s)      4 years and 6 months ago
Posted in : Java Beginners

Create a package named cs520.hw4.part2. Using this package, create the following classes. 1. Create a class named Student as follows. The class keeps track of the student√Ę‚?¨‚?Ęs homework grades. a. The instance (or member) private variables √Ę‚?¨‚?? name (String), homework1, homework2, homework3, homework4, homework5 and homework6 (all of type integer). b. A single constructor with name as its argument. c. The public set methods for the six homework instance variables. The get methods are optional. d. A public computeAverage method which takes no arguments and returns a double showing the average homework grade for this student. e. Override the toString method to return the string representation of this object in the format √Ę‚?¨Ň?The √Ę‚?¨‚?Ęs average grade is √Ę‚?¨¬?.

  1. Create a Test class to test the following functionality in its main method. a. Use the BufferedReader class to read the data.txt file. The contents of the file are shown below. Create the data.txt file in HW4_lastName. b. Read the contents of the text file one line at a time using a loop. The program should work for any number of input lines. Invoke the processInputData method for each line read. c. Write a private method processInputData which processes its string input argument as follows.
  2. Tokenize the string argument using the StringTokenizer class using the comma as the delimiter.
  3. Extract the name token. Create a Student object and assign to the variable currentStudent.
  4. Read each homework grade token one token at a time. Use the corresponding set method on the student object to set the instance value.
  5. Display the string representation of the currentStudent object to the console.

    Sample Input data.txt file:

Alice,44,79,85,72,77,57 Bob,79,94,70,71,71,51 Charlie,95,99,41,55,65,50 Dave,87,89,88,55,74,63 Ed,82,51,44,67,73,49

  Sample Output:

Alice's average grade is 69.00 .....

Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
java
java  diff bt core java and java
java
java  what is java
Advertisements
java
java  different between java & core java
java
java  explain technologies are used in java now days and structure java
java
java   why iterator in java if we for loop
Java
Java   Whether Java is pure object oriented Language
JAVA
JAVA  how the name came for java language as "JAVA
java
java  what is java reflection
java
java  is java open source
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
java   difference between class and interface
java
java  why multiple inheritance is not possible in java
java
java  send me java interview questions
java
java  Write a java code to print "ABABBABCABABBA
java
java  why to set classpath in java
java
java  RARP implementation using java socket
java
java  write a java program using filenotfoundexception
Java
Java  how to draw class diagrams in java
java
java  explain object oriented concept in java
java
java  is java purely object oriented language
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  what are JAVA applications development tools
java
java  how use java method
java
java  write a program in java to acess the email
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
Java
Java  how to do java in command prompt
Tutorials   
Java Spring Hibernate Struts Training What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile? How to create first Java Program? Retrieve database from the table dynamically in jsp from oracle using servlet What does core Java include? java What are some way to learn Java quickly?

Ads

 
Advertisement null

Ads