100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Samenvatting

Programming (2IP90) Summary 2019

Beoordeling
-
Verkocht
6
Pagina's
46
Geüpload op
28-05-2020
Geschreven in
2019/2020

EN: Programming (2IP90) is a course given at Eindhoven University of Technology. This course is mandatory for Bachelor Computer Science and Engineering students. It is a good introduction to a necessary skill. Programming teaches students how to program using the programming language Java. It shows how to make a program, what data types there are and what kind of structures can be given to programs (if-else, while-loops and for-loops). ---- NL: Programming (2IP90) is een vak die wordt gegeven op de Technische Universiteit Eindhoven. Dit vak is verplicht voor Bachelor Computer Science and Engineering studenten. Programming leert studenten hoe je moet programmeren met de programmeertaal Java. Het laat zien hoe je een programma maakt, welke data types er zijn en welke structuur kan worden gegeven aan programma's (if-else, while-loops en for-loops).

Meer zien Lees minder









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Documentinformatie

Geüpload op
28 mei 2020
Bestand laatst geupdate op
1 september 2020
Aantal pagina's
46
Geschreven in
2019/2020
Type
Samenvatting

Onderwerpen

Voorbeeld van de inhoud

2019 Q1 Programming Summary
Running a Java program: (1) type the text with at least 1 class (2) save file with name class
(3) compile file (checks for errors) (4) run the class file.
For naming things, use CamelCase(start each new word in a name with an uppercase letter)
Types of rules: (1) syntax (grammar) (2) semantic (meaning) (3) conventions (wise advice)

Topic How to write it in Java What it means
How to make a public class <nameClass> { This is the class declaration and is at the beginning of
program <statements> } every source code, it contains the whole program.
void <method>() { <statements> } Method declaration, it contains the activity of the
program.
System.out.println(“<text>”); Gives output and newline statement
public static void main(String[] args) { This is at the end of your program. The first part
new <class>().<method>(); } marks the start-up code and the second part creates
an active object from the class and starts the method.
Numeric/ int <name variable>; This creates a variable that is a integral number. Use
primitive data CamelCase but start with a lower case letter. Values:
types …, -1, 0, 1, … . Operations: +, -, *, /, %. E.g. (17+4)/2
gives 10. Equality by x==y, inequality by x!=y
Double <name variable>; This creates a variable that is a floating point number.
Values: … , -0.5, …, 0.7, … . (in)equal: see int.
Operations: +, -, *, / E.g. (17.0+4.0)/2.0 gives 1.5
Arithmeric 5 * 2 gives 10 Multiplication
operators (on Int: gives 2. D: 5. gives 2.5 Integer division (ordinary division)
numeric types) 1 + 1 gives 2. “1” + “1” gives “11” Arithmetic addition (string concatenation)
5 – 2 gives 3. – (5 - 2) gives -3 Subtraction (minus)
10 % 5 gives 0. 7 % 5 gives 2 Remainder or modulo (rest bij deling)
Math.pow(x,y) Machtsverheffen (x^y)
Textual data char <name variable>; This creates a variable that is a single character.
types Values: ‘a’, ‘0’, ‘?’, … . No operations!
String <name variable>; This creates a variable that has sequences of
characters (also “a”!). Values: “seven”, “a”, …
Operations: +, … E.g. “seven” + ”teen” gives
“seventeen”. Equal identity: x==y.
To compare strings, use “<String>”.equals(“...”).
To look at the alphabetical ordering, use
“<String1>”.compareTo(“<String2>”).
0: same place, -1: String1 is closer to beginning than
String2, 1: vice versa.
“<String>”.length() gives the number of characters.
“<String>”substring: gives subsequence by position
(e.g.“Building”.substring(1,4) → “uil”)
“<String>”.indexOf(“…”):gives position of substring
(e.g. “Building”.indexOf(“uil”) → 1)
Data type boolean <name variable>; This creates a variables that can evaluate to true or
Boolean false, depending on the input. Values: true, false
Operations: && (logical and), || (inclusive or),
! (logical not), ^ (exclusive or), == (equality)




1
By Isabel Rutten

, 2019 Q1 Programming Summary
Comparison 5 +7 == Comparing all primitive types (int, double, Boolean)
operators gives a true or false, it’s a Boolean value.
<string1>.equals(<string2>) Comparing String types (DON’T USE ==)




Scanner Input import java.util.Scanner; The user can insert values which can be used in the
class <name> { program by applying a scanner. Here, you can see all
Double amount; the necessary parts of using a scanner.
This: Scanner = new When no input is available, the scanner waits for
Scanner(System.in); input.
Public void <method>() { “scanner” can also be replaced by another word.
amount = scanner.nextDouble(); } Variants of “scanner.nextDouble()” (which reads the
Or like this: Scanner; next Double & stores it) are “scanner.nextInt()” (for
Public void <method>() { integers), “scanner.next()” (for Strings/a word),
scanner = new Scanner(System.in); “scanner.nextLine()” (for lines (whole line=String)).
amount = scanner.nextDouble; } It is also possible to “read” whether there even is a Int
or a Double with “scanner.hasNext()” (e.g.
scanner.hasNextDouble() checks for Doubles). These
statements will return “true” or “false.
If-construct if ( condition ) { The if-construct is used to execute statements only
... then-part when the condition is true, uses Boolean expressions.
} else { Here you can see the if-else construct.
... else-part If you leave out the part in bold, you have a if-
} construct with one branch only.
if ( A ) { Here you can see the if-else if construct.
... executed if A is true
} else if ( B ) {
... executed if B is true and A is not
true
} else if ( C ) {
... executed if C is true and neither A
nor B are true
} else {
... executed if A nor B nor C is true
}
if ( A1 ) { Here you can see the usage of nesting. This is hard to
if ( B1 ) { manage so it is better not to use it!
... A1 true and B1 true If you do, try to figure out what each branch means:
} else { this way you can avoid errors.
... A1 true and B1 false
}
} else {
if ( B2 ) {
... A1 false and B2 true
} else {
... A1 false and B2 false
}}




2
By Isabel Rutten

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
IsabelRutten Technische Universiteit Eindhoven
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
97
Lid sinds
5 jaar
Aantal volgers
66
Documenten
21
Laatst verkocht
3 weken geleden
Summaries for Computer Science, Industrial Engineering, and ICT in Business

If you have any questions about the summaries or other study-related topics, you can always send me a message on this platform. For a cheaper price, you can also message me privately: I only receive 40% of the price you pay on this platform. I hope that these summaries help you advance your studies!

4,4

12 beoordelingen

5
9
4
1
3
1
2
0
1
1

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen