Vous êtes sur la page 1sur 14

1/13/2016

Outlook.com Print Message

Print

Close

From:
Sent:
To:
Cc:

Vivek Paramasivam (paramv@cs.washington.edu)


Wed 11/20/13 11:09 AM
Larkin Hubrig (lhubrig@uw.edu)
Vivek Paramasivam (paramv@cs.washington.edu)

This document can be found on the web at the following URL:


https://courses.cs.washington.edu/courses/cse142/13au/student_programs/AL/lhubrig@uw.edu/a6/

CSE142Assignment6(BabyNames)ScoreSheet
Student(s):

LarkinKHubrig<lhubrig@uw.edu>

VivekParamasivam<paramv@cs.washington.edu>

Grader:
:.:..:.:...::.:....:...:.:::.::

9 / 20 : Total Score
3 / 9 : External Correctness
2 / 3 : Finding names
1 / 1 : Attempt (finds and displays a similar name)
1 / 1 : Correct (always finds correct name, case sensitivity, exact match only)
0 / 1 : Name-not-found case (no DrawingPanel, prints message)

1:makesagraphnomatterwhat
1

1 / 5 : Drawing (excluding constants)


/ 1 : Black lines, decade labels
/ 2 : Red lines and ranking labels (non-zero cases)
0 / 1 : Attempt (both items sometimes appear correctly)
0 / 1 : Correct

2:noredlinesorrankinglabels
0
0

/ 2 : Zero rankings
/ 1 : Attempt (sometimes draws zero ranking correctly at bottom)
/ 1 : Correct

2:norankinglabelsorredlinesongraphD:
0

/ 1 : All output exactly correct (excluding constants)

1:missingperiodatendofintro,printingdatatoconsole
6 / 11 : Internal Correctness
2 / 4 : Constants
1 / 1 : All 3 constants declared and used at least once
1 / 1 : Intro is correct
0 / 1 : Graphics are correct for names2.txt (excluding intro)
0 / 1 : Graphics are correct for all cases, constants used correctly in all places (excluding intro)

2:norankinglabelsorredlines
3 / 3 : Methods
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

1/14

1/13/2016

Outlook.com Print Message

1
1
1
0

/ 1 : 2 good methods other than main


/ 1 : 2 more good methods
/ 1 : Good decomposition: main is concise summary, no one method is too long, etc
/ 1 : Redundancy
/ 1 : Each rank is converted to a y-coordinate only once.

1:dataisnotconvertedtoycoordinates
0

/ 1 : Good comments

1:incompletecommentoncreatePanel
1

/ 2 : Otherwise good style (appropriate datatypes, localizing vars, nil beyond Ch.6, etc.)

1:indentation
Lateness and Other Deductions
Tue2013/11/1209:15pm
Mon2013/11/1104:37pm
0
0

Due
Submitted (on time)

Late days used on this assignment


Lateness deduction
Other deductions
Overall comments:

Whathappened?D:Yourgraphhasnorankinglabelsonit:(

https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

2/14

1/13/2016

Outlook.com Print Message

Annotations:Names.java
//LarkinHubrig
//11/11/13
//CSE142AL
//TA:Vivek
//Assignment#6Names
//Thisprogrampromptsforanameandgenderandtheniffound;
//itgraphsthatname'spopularity.fromthe
//SocialSecurityAdminstrationdata.
importjava.io.*;
importjava.awt.*;
importjava.util.*;
publicclassNames{

publicstaticfinalintYEAR=1880;
publicstaticfinalintNUMDECADES=14;
publicstaticfinalintWIDTH=70;
publicstaticvoidmain(String[]args)throwsFileNotFoundException{
Scannerinput=newScanner(newFile("names.txt"));
Scannerconsole=newScanner(System.in);

giveIntro();
System.out.print("name?");
StringuserName=console.nextLine().toLowerCase();
System.out.print("gender(MorF)?");
StringuserGender=console.nextLine().toLowerCase();
intrank=0;
Stringline=find(input,userName,userGender)
You should remove unused code for
the final version

;
if(line.length()>0){
rank(line);
//line=find(input,
userName,userGender);

indentation

}else{

System.out.println("name/gendercombinationnot
found");

}
createPanel();
pixelsCord(rank);

}
//introducestheprogramtotheuser
publicstaticvoidgiveIntro(){
System.out.println("Thisprogramallowsyoutosearchthrough
the");
System.out.println("datafromtheSocialSecurity
Administration");
System.out.println("toseehowpopularaparticularnamehas
been");
System.out.println("since"+YEAR);
System.out.println();
}
//searchesforandreturnsthenextlineofthegiveninputthat
contains
//thegivenphrase;returnsanemptystringifnotfound
publicstaticStringfind(Scannerinput,StringuserName,String
userGender){

indentation

while(input.hasNextLine()){
Stringname=input.next();
Stringgender=input.next();
Stringline=input.nextLine();
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

3/14

1/13/2016

Outlook.com Print Message

if(name.equalsIgnoreCase(userName)&&
gender.equalsIgnoreCase(userGender))

this brace should be on the previous


line

{
returnline;
}
}

return
"";

}
//Printstherank,rating,votes,andtitleseparatedbytabsfor
the
//givenlineoftheinputfile
publicstaticintrank(Stringline){
Scannerdata=newScanner(line);
Stringname=data.next();
Stringgender=data.next();
intpop=data.nextInt();
System.out.print(name+""+gender+""+pop
+"");
while(data.hasNext()){

You should not have printed data to


console.

System.out.print(data.next()+"");
}
System.out.println();
returnpop;
}

-1: This comment is incomplete


because it does not describe the full
function of the method. The method
also draws the grid lines and decade
labels.

//createsdrawingpanelwithgraph
givenwidth,numDecades,andstartingYEAR
publicstaticvoidcreatePanel(){
DrawingPanelp=newDrawingPanel((NUMDECADES*WIDTH),550);
Graphicsg=p.getGraphics();
//drawsverticallines
for(inti=0;i<=NUMDECADES;i++){
g.drawLine(WIDTH*i,0,WIDTH*i,550);
}
//printwhatdecadeitis
for(inta=0;a<=NUMDECADES
space out expressions

;a++){
g.drawString((""+(YEAR+(a*10))),WIDTH*a,550);
}
g.drawLine(0,25,(NUMDECADES*WIDTH),25);
g.drawLine(0,525,(NUMDECADES*WIDTH),525);
}

//turnsranktopixels
publicstaticintpixelsCord(intrank){
StringnumLine=(""+rank);
Scannerread=newScanner(numLine);
intstartPixel=525;
intpixel=0;
while(read.hasNextInt()){

everything inside of a loop should be


indented once over

intranking=read.nextInt();
if(ranking==0){
pixel=startPixel;

indentation

}else{
inty=25;
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

4/14

1/13/2016

Outlook.com Print Message

pixel=ranking+y;
y++;
}
}
returnpixel;
}

https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

5/14

1/13/2016

Outlook.com Print Message

TestingScriptOutput
Test1(normalconstantvalues:names.txt,1880,14,70)
Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880.
5
6name?Lisa
7gender(MorF)?F

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880
5
6name?Lisa
7gender(MorF)?F
8000000733220621664295
718

Differences
45c45
<since1880.
<

>since1880
>
7a8
>000000733220621664295718

Textoutput:
5571pixelsdiffer

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880.
5
6name?Don
7gender(MorF)?M

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880
5
6name?Don
7gender(MorF)?M
82842122191911486862107115
2033195548280

Differences
45c45
<since1880.
<

>since1880
>
7a8
>28421221919114868621071152033195548280
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

6/14

1/13/2016

Outlook.com Print Message

Textoutput:
6329pixelsdiffer

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880.
5
6name?ABBIE
7gender(MorF)?F

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880
5
6name?ABBIE
7gender(MorF)?F
8178199316449729806952000
725685591822

Differences
45c45
<since1880.
<

>since1880
>
7a8
>178199316449729806952000725685591822

Textoutput:
7057pixelsdiffer

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880.
5
6name?maya
7gender(MorF)?f

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880
5
6name?maya
7gender(MorF)?f
8000000000916507399113
66

Differences
45c45
<since1880.
<

>since1880
>
7a8
>00000000091650739911366
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

7/14

1/13/2016

Outlook.com Print Message

Textoutput:
5473pixelsdiffer

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880.
5
6name?eTHel
7gender(MorF)?f

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880
5
6name?eTHel
7gender(MorF)?f
8387813306510617635969200
00

Differences
45c45
<since1880.
<

>since1880
>
7a8
>38781330651061763596920000

Textoutput:
5719pixelsdiffer

Test2(modifiedconstantvalues:names2.txt,1920,10,90)
Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920.
5
6name?Lisa
7gender(MorF)?F

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920
5
6name?Lisa
7gender(MorF)?F
800733220621664295718

Differences
45c45
<since1920.
<

>since1920
>
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

8/14

1/13/2016

Outlook.com Print Message

7a8
>00733220621664295718

Textoutput:
4841pixelsdiffer

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920.
5
6name?Don
7gender(MorF)?M

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920
5
6name?Don
7gender(MorF)?M
814868621071152033195548280

Differences
45c45
<since1920.
<

>since1920
>
7a8
>14868621071152033195548280

Textoutput:
4963pixelsdiffer

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920.
5
6name?ABBIE
7gender(MorF)?F

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920
5
6name?ABBIE
7gender(MorF)?F
8729806952000725685591822

Differences
45c45
<since1920.
<

>since1920
>
7a8
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

9/14

1/13/2016

Outlook.com Print Message

>729806952000725685591822

Textoutput:
5067pixelsdiffer

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920.
5
6name?maya
7gender(MorF)?f

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920
5
6name?maya
7gender(MorF)?f
80000091650739911366

Differences
45c45
<since1920.
<

>since1920
>
7a8
>0000091650739911366

Textoutput:
4475pixelsdiffer

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920.
5
6name?eTHel
7gender(MorF)?f

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1920
5
6name?eTHel
7gender(MorF)?f
830651061763596920000

Differences
45c45
<since1920.
<

>since1920
>
7a8
>30651061763596920000
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

10/14

1/13/2016

Outlook.com Print Message

Textoutput:
4574pixelsdiffer

Test3(namenotfoundcase;imageshouldNOTbefound)

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880.
5
6name?zOIdBErg
7gender(MorF)?m
8name/gendercombinationnotfound

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880
5
6name?zOIdBErg
7gender(MorF)?m
8name/gendercombinationnotfound

Differences
45c45
<since1880.
<

>since1880
>

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880.
5
6name?lis
7gender(MorF)?f
8name/gendercombinationnotfound

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since1880
5
6name?lis
7gender(MorF)?f
8name/gendercombinationnotfound

Differences
45c45
<since1880.
<

>since1880
>

Test4(names3.txt,15decades,678,40px)
https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

11/14

1/13/2016

Outlook.com Print Message

Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since678.
5
6name?Ben
7gender(MorF)?M

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since678
5
6name?Ben
7gender(MorF)?M
81601762232643043344375201
958235290986124105

Differences
45c45
<since678.
<

>since678
>

Textoutput:
8955pixelsdiffer

Test5(names4.txt,5decades,2401,78px)
Expected Output

Actual Output

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since2401.
5
6name?Ben
7gender(MorF)?M

1This
programallowsyoutosearchthroughthe
2datafromtheSocialSecurity
Administration
3toseehowpopularaparticular
namehasbeen
4since2401
5
6name?Ben
7gender(MorF)?M
8160176223264304

Differences
45c45
<since2401.
<

>since2401
>

Textoutput:
2154pixelsdiffer

https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

12/14

1/13/2016

https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

Outlook.com Print Message

13/14

1/13/2016

https://blu178.mail.live.com/ol/mail.mvc/PrintMessages?mkt=en-us

Outlook.com Print Message

14/14