The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
A lab that combines various elements of OOP programming through the use of several different methods. I have already created code for this lab that seems right for the most part but there are some inaccuracies within it. That don't give me the correct output answers in the main method according to the rubric. You can adjust my code or create a new program, it doesn't matter to me. Thanks and I look forward to a response
CSCI 1301: Introduction to Computing and ProgrammingFall 2016Lab 13 – Method Overloading; One-Dimensional ArraysPart 1: Group Brainstorm (NO computers during this time)Good programmers think before they begin coding. Part I of this assignment involves brainstorming witha group of peers with absolutely no computers to talk about a strategy for solving this week’s lab.Breakup into groups based on your seating (3-4 people per group) and brainstorm about how to solve theproblem in Part 2 below. Make sure everyone understands the problem and sketch out potential ways tomove toward a solution. Write up a detailed description of your approach in English / pseudocode(English that is structured like a program). This should be 1-2 paragraphs in length (enough to convincethe grader that you have a plan for moving toward a solution). You may find it helpful to look over therequired readings for this week. Make sure to get the last names of those you have worked with – you willneed to provide it in your write-up for Part 2.Include in your write-up which course topics you think will be useful for the lab and a detailed plan forcompleting the exercise & answer the following questions:•Discuss how you will implement the new methods (on pg. 3 of this document).Part 2: Submit Individual Brainstorm (You can now use a computer)Login to eLC and submit a version of your group's brainstorm,written in your own wordsunder theAssignment Dropbox titled “Lab 13 Brainstorm”. *Note this is different than the Lab 13 Dropbox whereyou will submit your .java file for this assignment. Feel free to add any additional information that wasnot specified to your write-up. We prefer that you submit the brainstorm before the end of the first labperiod for the week. However, you can submit untilTuesday night at 9PM.Note: Brainstorms that are submitted without a student attending the lab will not begraded unless the student provides a documented excuse to the graduate TA.IntroductionThis lab focuses on method overloading and also gives you further practice working with some subtletiesof one-dimensional arrays. In it, you will modify theStatclass created in Lab 12, expanding itsfunctionality. If you recall, that class stored an array ofdoublevalues and computed the minimum,maximum, mode, and average of these values. There were also methods for getting and setting the arrayof values. In particular, there was a method calledsetDatawhich used adoublearray as its singleparameter, and it copied the values from that array to the underlying data array of theStatobject.In this lab, you will overload thesetDatamethod (and the class constructors as well), creating versionsthat use arrays ofint,long, andfloatvalues as parameters and handlesnullparameters properly(i.e. runtime errors should not occur when a parameter isnull). Adoublearray will still be usedinternally by theStatclass to store the values.You will also define an additional set of methods, allcalledappend, to add new values to the underlying data array.
/** Stat.java* Author: Will Jenkins* Submission Date: 11-11-16** Purpose: This program is supposed to allow for more* practice with the UML diagram. A stat class is supposed to be created* with various arrays, getters, and setter methods.** Statement of Academic Honesty:** The following code represents my own work. I have neither* received nor given inappropriate assistance. I have not copied* or modified code from any source other than the course webpage* or the course textbook. I recognize that any unauthorizedCSCI 1301: Project 1 Page 3* assistance or plagiarism will be handled in accordance with* the University of Georgia's Academic Honesty Policy and the* policies of this course. I recognize that my work is based* on an assignment created by the Department of Computer* Science at the University of Georgia. Any publishing* or posting of source code for this project is strictly* prohibited unless you have written consent from the Department* of Computer Science at the University of Georgia.*/public class Stat {private double [] data;public Stat(){data = new double[1];data[0] = 0.0;}public Stat(double [] d){data = new double[d.length];for(int i=0; i < d.length; i++){data[i] = d[i];}}public Stat(float [] d){data = new double[d.length];for(int i=0; i < d.length; i++){data[i] = d[i];}}public Stat(int [] d){data = new double[d.length];for(int i=0; i < d.length; i++){data[i] = d[i];}}public Stat(long [] d){data = new double[d.length];for(int i=0; i < d.length; i++){data[i] = d[i];}}
public class StatTester{public static void main(String[] args) {double[]data1 ={50.0,60.0};float[]data2 ={70.0F,80.0F};int[]data3 ={90,100};long[]data4 ={100L,110L};Statstat1 =new Stat();System.out.println("stat1data=" +stat1.toString());stat1.setData(data1);System.out.println("stat1data=" +stat1.toString());stat1.setData(data2);System.out.println("stat1data=" +stat1.toString());stat1.setData(data3);System.out.println("stat1data=" +stat1.toString());stat1.setData(data4);System.out.println("stat1data=" +stat1.toString());data1 =null;stat1.setData(data1);System.out.println("stat1data=" +stat1.toString());}}
Attachments:
-----------