代做COMP SCI 200: Programming I调试Java编程

COMP SCI 200: Programming I

12.10 ***zyLab: H12CustomApp (Required & Human Graded)

Objective: The goal of the H12CustomApp project is to expand your Java programming skills by creating a personalized application that interacts with a user and writes to and reads from text data files. This application is similar to H8 and H10 in that it is an interactive program with a modular design and a test bench. It is different from H10 in that there must be a method that writes to a data file and another method that reads from a data ¦le and the test bench has 2 test cases demonstrating that the read ¦le method works correctly and 2 test cases demonstrating that the write file method works correctly.

In this assignment, use only material through module/chapter 11, File Input and Output. For example, don't use instantiable classes or variables outside of methods other than static final variables (constants).

There are some different re§ection questions from previous human-graded assignments. Please download the template to see them.

Key Requirements:

Read File Method:

  This method should not use hardcoded file names or static fields. Instead, all required information, such as file paths, should be passed to it via parameters.

  The method must be capable of reading from a file provided through its parameters and return the contents appropriately.

   Determine a better name than readFile appropriate to your program.

   Make sure the method is more complex than simply returning all the data in the file as  a string. For example, select aspects of the contents to return specified by parameters. Don't reuse a method demonstrated in class materials or another assignment.

  The method header comment includes something about how errors are handled such as a file not being found.

   Don't use regular expressions other than a simple literal character such as a comma,  colon, semicolon, space, or tab, for example in the String split method. Use loops and branching statements to solve parsing problems.

   Must not interact with the user (don't use a Scanner reading from System.in within the method).

   Must use only the file input classes demonstrated in the course materials.

   Don't solely rely on the Java libraries when implementing methods, write the code!

  This method header comment has a summary and what happens on errors such as a file not being found. Examples are also helpful to include in the method header comments.

  When designing consider what the parameters should be:

 How does the main method tell the read ¦le method which ¦le to read? Will the

read ¦le method have a String parameter containing the ¦lename, a File object, or  an opened InputStream? Don't hardcode the name of the file to read from/write to within the method, pass it as a parameter.

 How do you tell the method which data to read? Is there a column of data to look at, such as the 2nd column, or a column with a speci¦c name? Are there speci¦c  lines to look for, such as having specific line numbers or containing specific values? (See example data ¦les RomeoAndJuliet.txt, 4Letter1SyllableWords.txt, exampleData1.tsv, exampleData2.tsv.)

 Are data structures (e.g., an array or ArrayList) passed in that will be ¦lled with the values? Or are values returned?

 Is there a throws clause or are any checked exceptions caught within the method?

 Is there a returned value that indicates an error (e.g., a string with the error message, an int with an error value, null for a reference type)?

Write File Method:

.  Similar to the read file method, this method should avoid hardcoded file names and static fields. All necessary data, including file paths and content to be written, must be supplied through parameters.

.  Determine a better name than writeFile appropriate to your program.

   Make sure the method is more complex than simply writing a single content string to the file. For example, pass a data structure and other parameters that have data and write them to the file. Don't reuse a method demonstrated in class materials or another assignment.

.  The method header comment includes something about how errors are handled such as a file not being able to be written.

.  Must not interact with the user (don't use a Scanner reading from System.in within the method).

.  Must use only the file output classes demonstrated in the course materials.

.  Don't solely rely on the Java libraries when implementing methods, write the code!

  This method header comment has a summary and what happens on errors such as a file not being found. Examples are also helpful to include in the method header comments.

  When designing consider what the parameters should be:

 How does the main method tell the write ¦le method which ¦le to write? Will the    write file method have a String parameter containing the filename, a File object, or an opened PrintWriter? Don't hardcode the name of the file to write to within the method, pass it as a parameter.

 How do you provide the method the data it will write? Are there multiple

parameters or data structures? Are there parameters that specify which part of the data structures to write to the ¦le?

 Is the file intended to be read by a program? For example are there just rows and columns of data? (See exampleData1.tsv, exampleData2.tsv).

 Is the file intended to be read by a human or through a browser such as having a title, summary, etc? (See ExampleTextReport.txt, ExampleHTMLReport.html)

 Is there a throws clause or are any checked exceptions caught within the method?

 Is there a returned value that indicates an error (e.g., a string with the error message, an int with an error value, null for a reference type)?

main method:

.  Must interact with the user or call methods that interact with the user.Safely reads in input using Scanner hasNextX methods before reading values using nextX methods or uses exception handling. Appropriate error messages should be printed out. The program should not crash on incorrect input.

.  Calls the read and write file methods.

.  Prompts the user before reading in values. For example, this may include the name of  the file to read from, which lines or fields to read, and what calculation to perform. This may include the name of the file to write to, whether a plain text file, a comma-separated values (CSV) file, an HTML file, or some other format.

.  There must always be something printed to System.out by the program.

.  Output values are appropriately described. For example, a number with a unit such as 42 degrees Celsius.

.  All methods must have a summary and it is typically useful to describe what happens on errors and provide examples.

.  When designing consider different choices:

 Are names of files already known (e.g., con¦guration ¦les such as myProg.dat that would be specified with a constant in main), or is the user prompted?

 Are specific parameters, specifying what to read, constants in the main method or provided by a user?

 For the read file method are data structures created empty in main or does the read method return the data structures?

 For the write file method are data structures filled with data from a user, from the read file method, or created?

Test Bench Implementation:

  You are required to create a separate Java file named TestH12CustomApp.java. This file must contain a method testH12CustomApp() that calls a minimum of four test cases:

  Two test cases for the Read File Method: A test case should involve creating a

temporary file with example data (see provided test cases and the createTestDataFile method), attempting to read this ¦le using the read file method, and validating the output against expected results.

  Two test cases for the Write File Method: A test case should write to a temporary file using the write file method and subsequently read the file (see provided test cases and the readTestDataFile method) to check if the contents match the expected data.


   Each test case must have an English summary specifying specifically what that test case is testing.

   Each test case demonstrates the method works as described in the method header comment.

   If a read ¦le method or write file method throws a FileNotFoundException, for example, it would be appropriate to catch that exception in a test case to verify that the method  is throwing it appropriately.

  Test Execution and Validation: The method should return true if all test cases pass (i.e.,  if the read and write operations produce the expected results in all instances),and false otherwise.

  Test cases should run without user interaction. Don't use System.in in test cases. Your code should not need to use Scanner in test cases.

   Integration with zyBooks: Your testH12CustomApp() method will be directly used by

the zyBooks platform. to evaluate the functionality and correctness of your ¦le handling methods.

   Ensure that your methods are robust and handle exceptions gracefully to avoid crashes during the testing phase on zyBooks. This meticulous testing ensures that your file

handling methods operate reliably under various conditions.

Set up the H12CustomApp project

Download H12CustomApp.java and TestH12CustomApp.java and make sure they compile    and run in your IDE (Eclipse or IntelliJ). Put all the non-Java ¦les in a "data" folder within the    project folder and not the source folder. The data files are provided as examples for you. You may choose to read from some files or create ¦les that have a similar structure. Don't expect to use the data files when submitting to zyBooks. Within your test cases, create your own

data files, examples of how to do this are provided in TestH12CustomApp.

Example Data Sources found through Google searches for free public data

  Tableau

  InterviewQuery

  Kaggle

  MRC Psycholinguistic Database

  Project Gutenberg

write ¦le Examples

 writeItemDataAsASimpleReport(String filename, String title, String[][] values, String total). Example ¦le contents:


Simple Report

Item Quantity Price Total

--------------------------------------

Item 1 3 $10.00 $30.00

Item 2 2 $15.00 $30.00

Item 3 1 $20.00 $20.00

Total:                $80.00

writeItemDataAsACSVFile(String filename, String[][] values).

Example file contents:

Item,Quantity,Price,Total

Item 1,3,$10.00,$30.00

Item 2,2,$15.00,$30.00

Item 3,1,$20.00,$20.00

writeItemDataAsAnHTMLReport(String filename, String title, String [] itemNames, int[] quantities, double []prices, double [] totals) See zyBooks 11.5.4.

or your own with a similar level of complexity.

Submission Guidelines:

Before submitting your work, ensure you remove the example methods and example test cases from your submission. These examples are provided solely for instructional purposes and should not be included in your final assignment.

Grading Criteria:

Your submission will be evaluated based on the main method and overall formatting requirements as previous human graded assignments and in addition:

The read and write method header comments include a summary comment, a description of error handling, and may include special cases and specifi c examples.

@param(s) and @return are present in the method header comments and have helpful descriptions. No additional @param or @return are included.

The read file and write file methods have reasonable names, typically a verb or verb phrase, that describe what the method does.

The read and write file method parameter(s) and local variables are clearly named, typically a noun or noun phrase.

The read and write file method are non-trivial.

a trivial read file method would read the entire file contents into a single string or ArrayList.

a trivial write file method would write a string parameter or two to the file.

There must be 4 test cases, 2 for testing the read file method and 2 for testing the write file method.

having an English description that indicates what the test case is doing and is different from the others

demonstrating the list method is working correctly by using predetermined outcomes and appropriate comparisons (e.g. didn't use != r == for double, or String)





热门主题

课程名

640481 csit128 eco000109m finc5090 ggr202h5f nbs8295 4ssmn902 chc6171 dsa1002 ebu6304 csci-ua.202 comp1021 ma416 mec206 iom209 com6511 bism7202 cpt206 cpt106 ecom209 comp1212 idepg001 math1062 mn-3526 fnce3000 fmhu5002 psyc10003 fina2222 be631-6-sp/1 finc2011 37989 5aaob204 citx1401 econ0028 bsan3204 comp9123 cmt218 itp122 qbus6820 ecmt1020 ecmt2150 bus0117 soft3202/comp9202 basc0057 mecm30013 aem4060 acb1120 comp2123 econ2151 ecmt6006 inmr77 com 5140 ocmp5328 comp1039 had7002h cmt309 asb-3715 elec373 cpt204-2324 be631-6-sp mast10007 econ3016 comp4403 comp30023 buss6002 finm1416 csc-30002 6qqmn971 fin668 mnfg309 inft2031 cits1402 comp2011 eecs 3221 ebu4201 ct60a9600 com336 8pro102 comp222 econ7300 ma117 comp3425 comp8410 comp2006 finm8007 comp26020 eeen3007j cis432 comp1721 csci251 comp5125m com398sust finm7405 econ7021 fin600 infs4205/7205 mktg2510- 32022 mth6158 comp328 finn41615 2024 mec302 mgmt3004 mgt7158 com160 as.640.440 f27sb csse2310/csse7231 rv32i eecs 113 comp1117b cs 412 comp 315 comp2017 ecs 116 fit5046 comp30024 acs341 econ1020 isys3014 acc408 comp1047 csc 256 cs 6347 comp5349 ecx2953/ecx5953 bios706 msin0041 econ339 finm7008 comp34212 csmde21 estr2520 comp285/comp220 mds5130/iba6205 finc6010 is3s665 busi2194 125.785 comp3310 mth6150 comp30027 busi2211 bff2401 fnce90046 visu2001 mang6554 finc6001 125785 data423-24s1 engi 1331 fint2100 comp20005 eec286 (520|600).666 cs 61b can202 mast20029 info20003 stat512 econ3208 cmpsc311 engg1340 ecmt1010 fit5216 basc0003 ee3121 acct2002 comp5313 busi2131 ise529 elec372/472 csit940/csit440 cenv6141 comp3027/comp3927 ftec5580 comp1433 msci223 mark203 en3098 eden1000 ece6483 econ4410 mats16302 cs 6476 com6521 comp3211 comp10002 csc1002 chc6186 cs 161 comp27112 comp282 swen20003 comm1190 elec9764 acfi3308 acct7101 fin6035
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图