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.html Welcome.cpp
Listing 2.1 ComputeArea.html ComputeArea.cpp
Listing 2.2 DisplayTime.html DisplayTime.cpp
Listing 2.3 FahrenheitToCelsius.html FahrenheitToCelsius.cpp
Listing 2.6 ComputeLoan.html ComputeLoan.cpp
Listing 2.7 ComputeChange.html ComputeChange.cpp
Listing 3.2 LeapYear.html LeapYear.cpp
Listing 3.3 AdditionTutor.html SubtractionTutor.cpp
Listing 3.8 GuessBirthDate.html GuessBirthDate.cpp
Listing 3.4 ComputeTax.html ComputeTax.cpp
Listing 4.2 SentinelValue.html SentinelValue.cpp
Listing 4.3 TestDoWhile.html TestDo.cpp
Listing 4.4 MultiplicationTable.html MultiplicationTable.cpp
Listing 4.5 TestSum.html TestSum.cpp
Listing 4.6 GreatestCommonDivisor.html GreatestCommonDivisor.cpp
Listing 4.7 FindSalesAmount.html FindSalesAmount.cpp
Listing 4.8 PrintPyramid.html PrintPyramid.cpp
Listing 4.9 TestBreak.html TestBreak.cpp
Listing 4.10 TestContinue.html TestContinue.cpp
Listing 4.11 PrimeNumber.html PrimeNumber.cpp
Listing 5.1 TestMax.html TestMax.cpp
Listing 5.2 FunctionWithoutReturnValue.html TestVoidFunction.cpp
Listing 5.3 TestPassByValue.html TestPassByValue.cpp
Listing 5.5 ComputeTaxWithFunction.html ComputeTaxWithFunction.cpp
Listing 5.8 PrintCalendar.html PrintCalendar.cpp
Listing 6.1 TestArray.html TestArray.cpp
Listing 6.2 AssignGrade.html AssignGrade.cpp
Listing 6.3 TestPassArray.html PassArrayDemo.cpp
Listing 6.6 LinearSearch.html LinearSearch.cpp
Listing 6.7 BinarySearch.html BinarySearch.cpp
Listing 6.8 SelectionSort.html SelectionSort.cpp
Listing 6.9 InsertionSort.html InsertionSort.cpp
Listing 6.10 GradeExam.html GradeExam.cpp
Listing 6.11 ComputeTax.html ComputeTax.cpp
Listing 6.13 TotalScore.html TotalScore.cpp
Listing 6.12 Sudoku.html Sudoku.cpp
Listing 9.1 TestLoanClass.cpp
Listing 9.2   Loan.h
Listing 7.10 TotalArea.cpp
Listing 9.5 Course.h
Listing 9.6 TestCourse.cpp
Listing 9.7 TestStackOfIntegers.cpp
Listing 7.8 StackOfIntegers.h
Listing 12.6 TestRationalClass.cpp
Listing 12.7 Rational.h
Listing 24.6 MyLinkedList.h
Listing 20.5 TestLinkedList.cpp