CPT307 Data Structures and Algorithms Week 1
Week 1 Assignment: Calculate Pay
This has been one of the most challenging assignments I have ever had to complete, and I can only hope that I get better at comprehending the Java syntax and keyword placement, etc. I had a lot of assistance from three different tutors, from the Ashford.edu tutoring link Dr. Limon provided us. I also did research on geeksforgeeks.org. It helped me in having a better understanding on what a “scanner class is in java.” Scanner is a type of class in Java which is used for entering several different input of strings, int, double, etc. From there I had to indicate that it was a public class, which means that other users can access and modify the code; as long as it states “public.” From there I entered the static final doubles, for the different taxes and deductions. They were entered as static final, since they were variables that only needed to be set once, and the double was required since the numbers were in decimal form. In other words, the keyword “double” is required when it is not a whole number (int). Next, I had to enter “public static void main(String[] args)” which means that it’s a public in order for Java to be able to run this method. The keyword “static” means that the class can be loaded into the memory and be accessed by the main method. The keyword “void” is used to let the program know that a return is not required. The keyword “main” is always necessary, in order for the code to run; which I had to learn after many failed attempts. The keywords “String[] args” is a Java command argument, which lets the program know that it contains strings.
From there it was necessary to “System.out.println” each piece of information that was required to show on the user’s monitor; from the employee’s name to their wage, and hours worked. Then it was necessary to create the formulas for each piece of information that was necessary. As far as the taxes and deductions, they were required to be programmed as “double”, since each response could potentially include decimal numbers and each was set to be multiplied by the hours worked, in order to calculate the taxes and deductions. Once all the taxes and deductions were calculated, they could all be added together and then subtracted from the gross pay, in order to know the net pay.
Once those were programmed in the code, it was time to “System.out.println” each line of necessary output. Which included the following:
- Employee Name
- Rate of Pay
- Hours Worked
- Overtime Worked
- Gross Pay
- Total amount of deductions
- Net Pay
After that last step, it is required to program “Calculate another employee? Y or N” in order for the program to continue on a loop or quit, if “n” is entered. Please see the figures below, to see the results of the program.
Resources
- 24 x 7 Availability.
- Trained and Certified Experts.
- Deadline Guaranteed.
- Plagiarism Free.
- Privacy Guaranteed.
- Free download.
- Online help for all project.
- Homework Help Services
Testimonials
Urgenthomework helped me with finance homework problems and taught math portion of my course as well. Initially, I used a tutor that taught me math course I felt that as if I was not getting the help I needed. With the help of Urgenthomework, I got precisely where I was weak: Sheryl. Read More