Computer Introduction
Download
Report
Transcript Computer Introduction
CSCI 115
Computer Programming Overview
Computer Software
• System Software
– Operating systems
– Utility programs
– Language compilers
• Application Software
Language Compilers
• Programming Generations
– 5 Generations
• 1GL - Machine Language
• 2GL - Assembly Language
• 3GL - Compiled Languages
– Procedural
» COBOL
» C
– OOP
» Java
» C++
• 4GL – SQL
• 5GL
Programming Languages
• C
– Powerful and flexible
• FORTRAN
– Mathematics and engineering
• COBOL
– Business
• JAVA
– Flexible
– Web based
• 100s of others
History of Java
• History of Java
– First started in 1990 as Sun’s Green project
• Digitally controlled consumer devices identified as trend
–
–
–
–
Oak
Trend did not grow as expected
1994 – WWW popularity
Netscape packaged Java within browser
• MS Explorer followed suit
– Success ultimately depended on e-commerce
Development Tools
• 1995 – First JDK released by Sun (1.0)
– Very limited
• JDK 1.1 released
– Limited GUI creation
• 1.2 released
– Major change – Swing components
– Java 2 SDK release 1.2
– Better known as Java 2
Development Tools
• Many environments within which to create
apps
– Any text editor
– Eclipse
– TextPad
Problem Solving Technique
•
•
•
•
Define Problem
Devise plan to fix problem
Implement the plan
Test
Steps in Java programming cycle
•
•
•
•
Use editor to create source code
Compile files
Link files
Execute program
Number Bases
• Electronic devices
– 2-state system: On = 1, Off = 0
– Base 2
• Converting from non-decimal to decimal base
– Expanded form
• Converting from decimal to non-decimal base
– Repeated division of non-decimal base
• Calculator
Java Program - Base Conversions
import java.util.*;
public class Bases {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
int valToConvert = 0, base = 0;
System.out.print("Enter the number to convert: ");
valToConvert = s.nextInt();
System.out.println();
System.out.print("Enter the base to convert to: ");
base = s.nextInt();
System.out.println();
System.out.print(valToConvert + " in base " + base);
System.out.println(" is: " + Integer.toString(valToConvert, base));
System.out.println();
}
}