programming

profiledanya.alsinan
ProgrammingProject1.pdf

Programming  Project  1   25  points     Submission  Instructions   Open  Eclipse  and  create  a  Java  Project  called  Project1.  Add  a  class  named  RoadTrip   to  this  project.     At  the  top  of  your  file,  enter  a  comment  with  your  name,  the  assignment  number,   the  date,  and  a  short  description  of  what  the  program  does.  For  example,  if  I  were   submitting  the  assignment  my  comment  might  look  like  this:     /**    *  Author:  Susanne  Sherba    *  Programming  Project  1    *  October  2,  2016    *  Calculates  gallons  of  gas  needed  and  number  of  stops  for  a  road  trip.        */     When  you  are  finished,  export  your  project  from  Eclipse  and  upload  it  to  Canvas   before  the  due  date.  To  do  this,  right  click  on  the  project  name  and  select  Export.   Select  General-­‐>Archive  File  and  click  Next.  Select  the  project  you  wish  to  export   (Project1  in  this  case)  and  click  Browse  to  browse  to  a  location  to  save  your  file.   Name  this  file  YourLastNameYourFirstNameProject1.  Upload  this  file  to  Canvas.   Remember  that  late  assignments  are  not  accepted  in  this  course.       Assignment     You  and  your  friends  are  planning  a  road  trip.    Write  a  program  that  asks  the  user   for  information  about  where  they  are  going  and  the  car  they  are  driving  and  then   gives  them  some  helpful  information  about  their  trip.    Specifically,  you  should  ask   the  user  for:  

• the  name  of  the  city  they  are  leaving  from   • the  name  of  the  city  they  are  going  to   • the  distance  between  the  two  cities   • how  many  miles  per  gallon  their  car  gets   • how  many  gallons  the  car's  gas  tank  holds    

You  should  output  the  name  of  the  starting  and  ending  cities,  the  number  of  gallons   of  gas  the  trip  requires  (with  one  decimal  place)  and  the  number  of  stops  you  will   need  to  make  along  the  way  (as  an  integer).  Make  sure  the  city  names  are   capitalized,  even  if  the  user  didn't  capitalize  them.  You  may  assume  that  your  gas   tank  is  full  at  the  beginning  of  the  trip.     Here’s  a  sample  interaction  with  the  user:    

Enter  city  you  are  leaving  from:  denver   Enter  city  you  are  driving  to:  jacksonville   Enter  distance  in  miles:  1748   Enter  miles  per  gallon  your  car  gets:  34   Enter  the  number  of  gallons  your  car's  tank  holds:  15.3     Your  trip  from  Denver  to  Jacksonville  will  require  51.4  gallons  of  gas.   Assuming  your  gas  tank  is  full  when  you  leave,  you  will  need  to  stop  to  fill  up  2  3   times.   Grading  Criteria  (25  points  possible)     Points   Criteria  

0-­‐5  points   Input:  Does  the  program  clearly  prompt  the  user  for  the  required   values  and  correctly  read  in  these  values  from  the  keyboard?  

0-­‐10  points   Correctness:  Does  the  program  correctly  calculate  all  required   values?  

0-­‐5  points   Output:  Is  the  output  displayed  in  a  way  that  is  easy  to  read?  Is  the   number  of  stops  displayed  as  an  integer?  Is  the  number  of  gallons   displayed  with  one  decimal  place?  Is  the  first  letter  of  each  city  name   capitalized?  

0-­‐5  points   Style:  Is  the  code  easy  to  read?  Is  the  code  indented  in  a  style  similar   to  that  shown  in  the  textbook?  Are  blank  lines  used  to  divide  the  code   into  sections?  Is  a  comment  with  the  required  information  included  at   the  top  of  the  file?  Are  comments  used  to  provide  details  that  are  not   obvious?  Are  meaningful  variable  names  used?  (See  Section  1.4  of  the   textbook  for  documentation  and  style  guidelines.)