EncyclopediaDramatica, a satirical wiki that documents internet culture (and pretty much makes fun of everything) defines Java as
Java is an interpreted language which is unique in that it includes a pretend compiler so that Java programmers can feel like they're using a grownup programming language. It is object oriented and has automatic garbage collection to make it as easy as possible to allocate memory.Java is like Alzheimers; it starts slow and eventually, it takes away all of your memory. Something Java fans like to talk about is the JIT compiler which eventually does turn Java into native code but only after it's been interpreted 10,000 times. By that time the program has probably already crashed with an out of memory error. Programming in Java drives most hackers permanently insane.
One thing I have realized is how much work one can put into Java, and how confusing it must look to the untrained eye. For example, I built a program below that makes a multiplication table up to the number that the user inputs:
import javax.swing.*;public class pw {
public static void main(String[] args) {
String matrixSize = JOptionPane.showInputDialog("Welcome to the Paul Welch multiplication table. What number would you like to multiply through?");int userMatrixSize = Integer.parseInt(matrixSize);
int column;
This is a program I built to build an employee payroll and report system. It took a great while, a lot of code memorization, patience, and correct syntax. It gathers the employees information, calculates taxes, and provides a monthly/yearly report.System.out.println("Multiplication Table through " + userMatrixSize);
for (row=1; row<=userMatrixSize; row++) {for (column=1;column<=userMatrixSize; column++) {System.out.print(" " + row*column + " ");System.out.println(" ");}System.out.println( " Thank you for using the Paul Welch Multiplcation Table " );
I suppose it makes me appreciate that most code for basic functions are stored in an API and what not, and I also appreciate the programmers who spent tedious hours writing it.
public class pwEmployeePayroll{public static void main(String args[]){ // declare varsString hrWage;String hoursWeek;String dedPer;String howManyYear;String employeeName;double hourlyWage=0.00;double hoursPerWeek=0.00;double deductionPaycheck=0.00;double lessThanTwenty = .10;double betTwenThir= .15;double greatThir= .19;double totalPaid=0.00;double totalPaidPreTax=0.00;double totalTaxesPaid = 0.00;double paycheckAmount=0.00;String monReport;int monthsReport = 0;double x = 20.00;double y = 30.00;String howManyMonths;// introSystem.out.println("Welcome to the Paul Welch Tax Calculator." );System.out.println(" This program will gather information from you and calculate relevant items, such as taxes.");System.out.println("Lets gather some information about the employee on which you seek information!");System.out.println(" Note : please enter all numbers in a whole number form, i.e. 30.00");// get user infoemployeeName= JOptionPane.showInputDialog( " What is the employees name?");hoursWeek=JOptionPane.showInputDialog(" How many hours does the employee work a week ");hoursPerWeek = Double.parseDouble(hoursWeek);while ( hoursPerWeek <=0 ){System.out.println(" Invalid Entry. Try again");hoursPerWeek = Double.parseDouble(JOptionPane.showInputDialog( " What is the employees hours per week?"));} // Validate entryhrWage=JOptionPane.showInputDialog( " What is the employees hourly wage");hourlyWage= Double.parseDouble(hrWage);while (hourlyWage <=0){System.out.println("Invalid Entry. Please enter again");hourlyWage = Double.parseDouble(JOptionPane.showInputDialog(" What is the employees hourly wage"));} // Validate entrytotalPaidPreTax = hoursPerWeek * hourlyWage;//Calculations : figure out total taxes paid and what notif (hourlyWage < x || hourlyWage != 0){totalTaxesPaid = (totalPaidPreTax * lessThanTwenty);}if (hourlyWage >= x && hourlyWage <= y){totalTaxesPaid = (totalPaidPreTax * betTwenThir);}if (hourlyWage > y){totalTaxesPaid = (totalPaidPreTax * greatThir);}paycheckAmount = (totalPaidPreTax - totalTaxesPaid); System.out.println(" Per month, the employee's information is as follows:");System.out.println("Employee Name " + employeeName);System.out.println("Paycheck amount " + paycheckAmount);System.out.println("Total taxes paid " + totalTaxesPaid);System.out.println( "Total paid pre-tax " + totalPaidPreTax );// Basic information is set and stored, now onto calculating over time periodsmonReport =JOptionPane.showInputDialog( "Would you like to calculate that with additional months? Please enter Y or N");while ((monReport.compareTo("Y") !=0) && (monReport.compareTo("N") !=0)){System.out.println("Invalid Response. Please enter Y or N");} // Validate entry
while(monReport.equals("Y")){howManyMonths = JOptionPane.showInputDialog("How many months would you like to calculate");// Input, then calculatemonthsReport = Integer.parseInt(howManyMonths);paycheckAmount = paycheckAmount * monthsReport;totalPaidPreTax = totalPaidPreTax * monthsReport;totalTaxesPaid = totalTaxesPaid * monthsReport;System.out.println( "For that amount of months, the employee's pay and taxes is as follows");System.out.println("Employee Name " + employeeName);System.out.println("Paycheck amount " + paycheckAmount);System.out.println("Total taxes paid " + totalTaxesPaid);System.out.println( "Total paid pre-tax " + totalPaidPreTax);String yearlyReport=JOptionPane.showInputDialog("Would you like a yearly report on this employee? Enter Y for yes or N for no");while(yearlyReport.equals("Y")){howManyYear= JOptionPane.showInputDialog(" How many years would you like to calculate?");int howManyYears = Integer.parseInt(howManyYear);System.out.println("Yearly report is as follows:");paycheckAmount = paycheckAmount * howManyYears;totalPaidPreTax = totalPaidPreTax * howManyYears;totalTaxesPaid = totalTaxesPaid * howManyYears;System.out.println("Employee Name " + employeeName);System.out.println("Paycheck amount " + paycheckAmount);System.out.println("Total taxes paid " + totalTaxesPaid);System.out.println( "Total paid pre-tax " + totalPaidPreTax);while((yearlyReport.compareTo("Y") !=0) && (yearlyReport.compareTo("N") !=0))System.out.println("Invalid Response. Please enter Y or N");yearlyReport =JOptionPane.showInputDialog(" Would you like another yearly report on this employee? Enter Y for yes or N to quit the program");}
What do y'all think about Java and other languages? Feel free to comment
c++ is more common in the real world due to the ability to have a greater control over your program by implementing C code with a greater control over memory allocation. people also argue that C++ is faster b/c its compiled and not interpreted like java. although optimizations in the java runtime environment have closed the gap between the two languages. java is a great starting language and is easy to use for web apps but learning lower level languages such as assembler is that you can gain an understanding of what your program is actually doing instead of just using this method for that and that method for this. makes you a more desirable programmer in the job market.
ReplyDelete