DOC PREVIEW
Duke CPS 004 - Java 3

This preview shows page 1-2-3-4 out of 11 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 11 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CompSci 4Java 3 Nov 27, 2007Prof. Susan RodgerAnnouncements• Assignment 7 – Storyboard due today– Assignment and web page due Thursday• Turn in Alice world, web page, and README file• Also link in web page– Demo due next Tuesday• Last Java classwork is this Thursday– All Alice classwork must be checked off by 11/30 to receive credit– All Java classwork must be submitted by Dec. 4 to receive credit.Java – Method/function format• Method must be part of a class• Method must have a return type– Return type is “void” if no return type (method)– DO not use the name of the class or method for any variable• Method has list and type of parameters• Declare types of all local variables first– Exception: loop variablesMore on indexOfString class = “CPS 4 and CPS 6 and CPS 4G”;System.out.println(class.indexOf(“CPS”));System.out.println(class.indexOf(“CPS”, 6));System.out.println(class.indexOf(“CPS”, 14));• IndexOf with a string and number argument finds the position of the first occurrence starting from that number position onProblem• Given a Phrase and a word, return true if the word occurs at least twice in the phrase.Finish Code – What does this do?Java Code - Note• How many variables are there and what are there types?• How many times is a variable declared (given its type)?• Where is the return value?• How many parameters and what are their types?Adding a helper method to a classpublic class NameOfClass{public String someMethod(String [] str){ // code here}public int helperMethod(String str, int n){ // code here}}Adding a helper class• Note the following– Names of methods and how many– Location of methods– Return types– Parameters– Where do return statements go?Classwork today• Create Java Project: CPS4Sec1Nov27• Classwork today – 3 APTs, 1 is extra credit– Protein Counter – number of strings that have at least 3 copies of given amino acid• Consider a helper function to count number of amino acids in one string– DNAHeavyMax – most frequent occuring nucleotide• Consider a helper function– ProteinFinder – finding a protein• Use indexOf to find codons• Search for stop codon past the start codon, not from beginning of stringExtra Credit• Include extra credit in same project. • Submit all three APTs at the same


View Full Document

Duke CPS 004 - Java 3

Documents in this Course
Lecture

Lecture

18 pages

Chapter 7

Chapter 7

18 pages

Chapter 9

Chapter 9

15 pages

Java 1

Java 1

24 pages

Lecture

Lecture

10 pages

Chapter 4

Chapter 4

28 pages

Chap 2

Chap 2

16 pages

Graphics

Graphics

20 pages

Lecture

Lecture

12 pages

HTML

HTML

16 pages

Java 1

Java 1

6 pages

Chapter 4

Chapter 4

16 pages

The Plan

The Plan

25 pages

Lecture

Lecture

16 pages

Chapter 6

Chapter 6

21 pages

Lecture

Lecture

18 pages

Lecture

Lecture

23 pages

Lecture

Lecture

16 pages

Lecture

Lecture

19 pages

Lecture

Lecture

12 pages

Lecture

Lecture

5 pages

Lecture

Lecture

26 pages

Lecture

Lecture

16 pages

Chapter 7

Chapter 7

23 pages

Lecture

Lecture

21 pages

Lecture

Lecture

4 pages

Lecture

Lecture

4 pages

Lecture

Lecture

8 pages

Lecture

Lecture

4 pages

Lecture

Lecture

10 pages

Chapter 4

Chapter 4

32 pages

Java

Java

4 pages

CompSci 4

CompSci 4

18 pages

Lecture

Lecture

26 pages

CompSci 4

CompSci 4

12 pages

HTML

HTML

17 pages

Lecture

Lecture

16 pages

Chapter 5

Chapter 5

22 pages

Lecture

Lecture

4 pages

Chapter 4

Chapter 4

10 pages

Chapter 2

Chapter 2

15 pages

Chapter 8

Chapter 8

14 pages

Lecture

Lecture

15 pages

Load more
Download Java 3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Java 3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Java 3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?