Core Version
Comprehensive Version
Introduction to Java Programming, 7E
 
Y. Daniel Liang

JavaScript and C++ Versions for Selected Java Programs in the Text

The syntax of Java, JavaScript, and C++ are very similar. This page gives the JavaScript and C++ versions of many Java programs in the text. There are two reasons for this page:

  • Java, JavaScript, and C++ are all important languages. Once you know problem solving and programming using Java, it is easy to learn JavaScript or C++, and vice versa.
  • Instructors may teach a little bit of JavaScript along with Java to stimulate student interests in programming. Students can use Java to create useful GUI, but it is difficult to learn GUI programming early. Using JavaScript, students can write simple, short, and interactive programs in Chapter 2.
Java JavaScript C++
Click the hyperlink to run JavaScript programs. To see the JavaScript source code, right-click the mouse on the browser and choose View Source.
Listing 1.1 Welcome.java Welcome.html Welcome.cpp
Listing 2.1 ComputeArea.java ComputeArea.html ComputeArea.cpp
Listing 2.2 DisplayTime.java DisplayTime.html DisplayTime.cpp
Listing 2.3 FahrenheitToCelsius.java FahrenheitToCelsius.html FahrenheitToCelsius.cpp
Listing 2.6 ComputeLoan.java ComputeLoan.html ComputeLoan.cpp
Listing 2.7 ComputeChange.java ComputeChange.html ComputeChange.cpp
Listing 3.2 LeapYear.java LeapYear.html LeapYear.cpp
Listing 3.3 AdditionTutor.java AdditionTutor.html SubtractionTutor.cpp
Listing 3.8 GuessBirthDate.java GuessBirthDate.html GuessBirthDate.cpp
Listing 3.4 ComputeTax.java ComputeTax.html ComputeTax.cpp
Listing 4.2 SentinelValue.java SentinelValue.html SentinelValue.cpp
Listing 4.3 TestDoWhile.java TestDoWhile.html TestDo.cpp
Listing 4.4 MultiplicationTable.java MultiplicationTable.html MultiplicationTable.cpp
Listing 4.5 TestSum.java TestSum.html TestSum.cpp
Listing 4.6 GreatestCommonDivisor.java GreatestCommonDivisor.html GreatestCommonDivisor.cpp
Listing 4.7 FindSalesAmount.java FindSalesAmount.html FindSalesAmount.cpp
Listing 4.8 PrintPyramid.java PrintPyramid.html PrintPyramid.cpp
Listing 4.9 TestBreak.java TestBreak.html TestBreak.cpp
Listing 4.10 TestContinue.java TestContinue.html TestContinue.cpp
Listing 4.11 PrimeNumber.java PrimeNumber.html PrimeNumber.cpp
Listing 5.1 TestMax.java TestMax.html TestMax.cpp
Listing 5.2 TestVoidMethod.java FunctionWithoutReturnValue.html TestVoidFunction.cpp
Listing 5.3 TestPassByValue.java TestPassByValue.html TestPassByValue.cpp
Listing 5.5 ComputeTaxWithMethod.java ComputeTaxWithFunction.html ComputeTaxWithFunction.cpp
Listing 5.8 PrintCalendar.java PrintCalendar.html PrintCalendar.cpp
Listing 6.1 TestArray.java TestArray.html TestArray.cpp
Listing 6.2 AssignGrade.java AssignGrade.html AssignGrade.cpp
Listing 6.3 TestPassArray.java TestPassArray.html PassArrayDemo.cpp
Listing 6.6 LinearSearch.java LinearSearch.html LinearSearch.cpp
Listing 6.7 BinarySearch.java BinarySearch.html BinarySearch.cpp
Listing 6.8 SelectionSort.java SelectionSort.html SelectionSort.cpp
Listing 6.9 InsertionSort.java InsertionSort.html InsertionSort.cpp
Listing 6.10 GradeExam.java GradeExam.html GradeExam.cpp
Listing 6.11 ComputeTax.java ComputeTax.html ComputeTax.cpp
Listing 6.13 TotalScore.java TotalScore.html TotalScore.cpp
Listing 6.12 Sudoku.java Sudoku.html Sudoku.cpp
Listing 9.1 TestLoanClass.java TestLoanClass.cpp
Listing 9.2 Loan.java   Loan.h
Loan.cpp
Listing 7.10 TotalArea.java TotalArea.cpp
Listing 9.5 Course.java Course.h
Course.cpp
Listing 9.6 TestCourse.java TestCourse.cpp
Listing 9.7 TestStackOfIntegers.java TestStackOfIntegers.cpp
Listing 7.8 StackOfIntegers.java StackOfIntegers.h
StackOfIntegers.cpp
Listing 12.6 TestRationalClass.java TestRationalClass.cpp
Listing 12.7 Rational.java Rational.h
Rational.cpp
Listing 24.6 MyLinkedList.java MyLinkedList.h
Listing 20.5 TestLinkedList.java TestLinkedList.cpp