Skip to main content

SIT102 Introduction to Programming Pass Task 4.1: Messy Code

SIT102 Introduction to Programming
Pass Task 4.1: Messy Code
This task will help demonstrate the value of correct code formatting, indentation, naming, and consistent use of case. We will give you some code that mostly works, but that has a number of issues with its format and coding conventions used, and it is your job to fix this code so that it is easy to read and understand.
Submission Details
Submit the following files to Doubtfire.
The fixed program code
A screen shot of your program running
Focus on code quality, making sure the program code is easy to understand.
Instructions
Download the associated resources which contain the code for a working program.
Open the code, and read it…
Is it easy to follow?
Can you see the structure quickly?
What do all of the names mean?
Please make this better… use what you know of good code quality to make this code easier to read and easier to understand. Think about indentation, naming, and use of case. This will include:
Ensure that all names are meaningful, and reflect what they relate to
Make sure names use the correct case (snake_case in most cases, UPPER_CASE for constants)
Make sure that the indentation is correct
Locate and fix the logical bugs… there are comments in the code to indicate what is not working as expected.
When you are happy, save and backup your work then submit to Doubtfire.
===========================
SIT102 Introduction to Programming
Pass Task 6.1: Working with Arrays
Overview
In this task you will create a simple program which will create an array with a user specified size. This array will then be populated with values, printed out to the console, and then, we’ll use the values to calculate some basic statistics.
Submission Details
Use the instructions on the following pages to create a small program to explore the use of arrays.
Submit the following files to Doubtfire.
Your program code
A screen shot of your program running
The focus of this task is on the declaration and use of arrays.
Instructions
Lets get started.
1. Watch the Working with Arrays video as a background for this task, you will need to implement the same logic but will read in double values rather than integers.
2. Create your own Working With Arrays project, and copy in the code of your user input functions, or your custom terminal user input code file and header.
3. Add the following functions and procedures based on the Working with Arrays video:
5. Extend the program with the following additions:
Add a function that calculates and returns the count of the number of negative values (those 0) in the array.
For this you will need a local result variable that starts at 0, and you add one to the result for each element of the array that is 0 .
Print out the count of the number of negative values at the end of the program.
For this you will need a local result variable that starts with the value of the first element of the array. You can then loop over the remaining array elements (from index 1 to the last).
===========================
SIT102 Introduction to Programming
Pass Task 6.2: Working with Vectors
Overview
In this task you will change your working with arrays program to use a dynamic array (vector in C++) to keep track of a number of values for the user.
Submission Details
Use the instructions on the following pages to create a small program to explore the use of arrays.
Submit the following files to Doubtfire.
Your program code
A screen shot of your program running
The focus of this task is on the declaration and use of dynamic arrays (using the vector class in C++).
Instructions
Lets get started.
1. Watch the Working with Vectors video as a background for this task, you will need to implement the same logic but will read in double values rather than integers.
2. Return to your own Working With Arrays project, and make the same changes as shown in the video:
==================================
SIT102 Introduction to Programming
Pass Task 7.1: Arrays and Structs
Overview
In this task you will create a small program that will read in data related to cars and passengers. This will allow us to model more complex data, where the car has a driver and a number of passengers who are all people (modelled as the person struct in the program). This task will help you learn how to work with more complex structures using combinations of dynamic arrays and structs.
What you learn in completing this task will be needed to complete the following task where you will need to design and implement a similar solution using the same programming tools and methods.
Submission Details
Use the instructions on the following pages to create a small program that explores a more complex use of arrays and structures.
Submit the following files to Doubtfire.
Your program code
A screen shot of your program running
The focus of this task is on the tools and approaches to working with more complex data using structs and dynamic arrays, with matching functions and procedures to help ease the coding efforts.
Instructions
To get started:
1. Create a folder for your project, and set this up as a new C++ project.
2. Download the associated task resources. This includes the starter code to read and print person data. Extract the program.cpp file from this, and use it to replace the initial program.cpp file in your project.
3. Watch the Array and Structs video, and follow the steps to update the starter code with the car details. Make sure this is all working correctly before you proceed.
Now you need to make the following small changes before you submit:
4. Add a procedure to print all of the cars driven by a given driver name. This procedure must accept a name parameter, being the name of the driver. For example, the procedure could be called to print all of the cars driven by -Charlotte-.
5. Change main to read in the name to check from the user, and then call your newly created procedure.
6. Submit your program code along with a screenshot of it working.



Logo
.
CLICK HERE TO ORDER 100% ORIGINAL PAPERS AT PrimeWritersBay.com

Comments

Popular posts from this blog

Why was this movie important to hollywood? What was the feeling of it, the colors, techniques, theme, director, style, music, anything! What was special about Alfred Hitchcock and this film?

  Directions For this assignment, you will need to choose a topic or person from any of the various eras, movements or decades that we've discussed this semester and do a presentation on them using any media format you choose. (IM CHOOSING THE MOVIE PSYCHO-    Why was this movie important to hollywood? What was the feeling of it, the colors, techniques, theme, director, style, music, anything!  What was special about Alfred Hitchcock and this film? The subject matter doesn't have to be limited to an actor, director or filmmaker, but  the topic of your presentation could be on the inventions of any of the equipment, editing or filming techniques that you've learned about.  Basically, you can pick an area to cover and do your presentation on that.  The point is that you take a deeper dive into the subject by exploring information about it that may not have been  covered in this course.  It does have to...

Account Cost Systems and Cost Behaviors

  ACC501 Account Cost Systems and Cost Behaviors You are applying for a managerial position at an innovative and rapidly growing company. This is a dynamic company that wants an individual who adds value to the organization. Managers at this company wear many hats, so the position requires managing products, people, and financial aspects of running the company. As part of the interview process, you are required to make a presentation covering four different topics, one per module for this course. You choose the company and the new product that you want to showcase in your presentation. It can be real or fictitious (based on an industry). This is for background purposes only. The presentation is to showcase your abilities and what you can contribute to the organization. IBIS World (access on the Trident Portal through the Online Library > Additional Library Resources > IBISWorld link) and BizStats have estimates of cost of goods sold ...

Starting with this provided code, add the following functionality

1.Starting with this provided code, add the following functionality: Replace hardcoded strings “Zero”, “One”, “Two”, “Three” in the ArrayList based on user typed input (use Scanner or JOptionPane classes). The user will be prompted for the String to be stored in the ArrayList and then hit enter. The user will be able to continue to add items to the ArrayList until they just hit enter without typing anything. Once the user does this (hits enter without typing anything), the program will display all of the elements of the ArrayList, both the index and String values, in a table. It will do this via a single loop making use of an iterator method. 2. Starting with this provided code, add the following functionality: Use a Try/Catch block so that the exception is caught and the program exits a bit more gracefully. Save this file as TryCatch.java. (Be sure to rename the Public Class accordingly.) Starting with the provided code again (without the Try/Catch block), fix the code so that ...