Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 1 You are given a file named DailyHelper.txt that contains the information of daily helpers that are available in an online system. The data

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
QUESTION 1 You are given a file named DailyHelper.txt that contains the information of daily helpers that are available in an online system. The data in the file are arranged in this order: helper nametstate#area #hourly rate#total hours worked, where the symbol + is used as the separator between data. And, a class named Helper with the following data and methods is also given public class Helper private String name; private String state; // Perak, Terengganu, etc private String area; 1/ Tapah, Chendering etc private double hourlyrate; private int hourworked; public Helper (String, String, String, double, int) (-) // setters 11 getters tostring Write a Java program segments to do the following: a) Open a file input named DailyHelper.txt, and file outputs named ganu.txt and pay.txt. (2 marks) b) Read data from the file input and calculate the daily pay. Write the information into the files below: ganu.txt to display the name of daily helpers from Terengganu. pay.txt to display the name of the daily helpers and their daily pay. Daily pay is calculated as follows: Daily pay = hourly rate x total hours worked Display the following information to the output screen: Total amount paid for all daily helpers: RMXXX.XX (7 marks) QUESTION 2 A company has three categories of employee, programmers, system analysts and general helpers. In designing a system for the company, Digital Solutions came up with the following definition for the Employee class which is defined as the superclass. The other classes such as Programmer, SystemAnalyst and GeneralHelper are defined as the subdasses. public class Employee private String name; private double monthlysalary: public Employee (string, double) ...) 1/ retrieval methods public String getName() ... public double getMonthlysalary() (...) public void print () a) Write a complete definition for class Programmer which has an additional data member, double extraPay and with the following methods: normal constructor to initialize the name and the monthly salary of the programmers, while extra pay is initialized to 0. a getter to return the extraPay. a printer to display all information of the programmer. calxtraPay(int) that receives the number of lines written by the programmers as parameter, calculates and sets the value of the extra pay. The extra pay for the programmers depends on the lines of codes as given in the table below: Code (line) Pay(RM) / line 1000- 2.30 2000 >2000 (8 marks) b) Write Java application segments for the following tasks: 1) Declare an array to store 15 Programmer objects. (1 mark) 1) Find and display the information of employee with the highest income. Highest income is calculated by adding the monthly salary and extra pay. (6 marks) 2.50 QUESTION 3 in the University Indoor Games, among the games involving individual competitors are Chess and Scrabble. The following dasses are used to store information on competitors for the events. Competitor Chess Comp ScrabbleComp These are information about the classes: class Competitor (abstract class) private data members: String name String university public member methods: normal constructor String getName() String getUniversity int calculateTotalPoints() - abstract method class Chess Comp inherits from Competitor) private data members: int numwin int numLoss public member methods: normal constructor int get Numkin() int get NumLoss() int calculate total points() class ScrabbleComp (inherits from Competitor) private data members: int numWords public member methods: normal constructor int getNumWords () int calculate total points) a) Given the following array declaration and initialization: Competitor compt] - new Competitor [100); Get the data for competitors for the Chess and Scrabble competitions from the user and store into the comp array. (6 marks) b) Get the name of a university from the user and display the total points of the university from those competitions. (5 marks) c) Display the name of competitors participating in the Scrabble Competition and the total number of words formed by the competitor. (4 marks) QUESTION 4 Final Examination CSC238, December 2019 Part B - Question 4 QUESTION 5 Final Examination CSC238, December 2019 Part B - Question 5 QUESTION 6 Final Examination CSC238, December 2019 Part B - Question 6

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago