Programming Essay

1418 words - 6 pages

Programming 1 - Semester 1, 2015
Assignment 1
Release Date: 27 / 02 /2015
Total raw marks: 60
Assignment weight: 6%
NOTE: This assignment is to be undertaken individually—no group work is permitted.

Background information
For this assignment you are to complete a partially completed menu-driven, Java console
application, which allows the user to select one of four options:



Display Time and Date
Swim Fitness Summary Calculator
Sentence Analyser
Exit

The incomplete code solution (in the source file called MenuDrivenProgram.java) is in the same
Assignment 1 folder, available via myRMIT.
The partially completed program already has code to display the menu. You ...view middle of the document...

Once the required values have been read in the program should to calculate the relative swim
fitness index (in terms of laps per minute per kg) as follows and displayed to the screen:

swim fitness index = (number of laps / time) / weight
Once the swim fitness index has been calculated and displayed the program should determine
whether the swim fitness index for the session was less than, equal to or greater than a
benchmark swim fitness index that has been set of 0.025 - a suitable message should be
displayed to the screen accordingly indicating swim fitness index for the session was below, equal
to, or above the benchmark that has been set.
Examples are given below for the different scenarios.
Example 1 - fitness level decreasing:
Enter number of laps: 40
Enter time taken in minutes: 25
Enter weight in kg: 80
Swim fitness level achieved in session was 0.02
Session swim fitness index was below the benchmark swim fitness index by 0.005
Example 2 - fitness level unchanged:
Enter number of laps: 40
Enter time taken in minutes: 20
Enter weight in kg: 80
Swim fitness level achieved in session was 0.025
Session swim fitness index equalled the benchmark swim fitness index
Example 3 - fitness level decreasing:
Enter number of laps: 50
Enter time taken in minutes: 25
Enter weight in kg: 50
Swim fitness level achieved in session was 0.04
Session swim fitness index was above the benchmark swim fitness index by 0.015

Note that the user may enter different values for the number of laps, time and weight.

2

Menu option C – Sentence analyser (20 Marks)
The program should initially prompt the user to enter a sentence, reade that sentence in from the
keyboard and store it in a variable for later use.
Once the sentence has been read in the program should produce an analysis of the structure of
the sentence by calculating and displaying the following statistics:

The length of the sentence

The number of upper and lower case letters in the sentence

The number of digits in the sentence

The number of whitespace characters in the sentence

Whether the sentence is a valid sentence or not - any sentence ending in a period ('.'), a
question mark ('?') or an exclamation point ('!') is considered to be a valid sentence for this
purposes of this task.

A sample run is shown below to demonstrate how the program should run:
Enter sentence: The quick BROWN fox jumped over the 2 lazy dogs (or was it 3?).

Sentence statistics:
- Length of sentence:
- Upper case characters:
- Digits:

63
6
3

- Lower case characters: 39
- Whitespace characters: 13
- Valid sentence:
YES
Note that this sample execution run is presented for example purposes – the user may specify a
sentence that contains different number of the character types you are looking for and may or may
not be a "valid" sentence based on the criteria mentioned above.

3

Code commenting / General coding style (7 + 4 + 4 =...

Other Papers Like Programming

Programming Solutions Essay

715 words - 3 pages Programming Solutions Being able to create a solution to a certain problem through programming can be a huge task to undertake, but it is a task that must be accomplished in order to get certain things done. Many companies face problems in the IT field that can be solved through programming, from simple to very complex, these problems usually require some sort of input and variables in order to create a solution. One problem that I face in the

Java Programming Essay

925 words - 4 pages Credit Units 20 0 20 200 Level Course Code 1st Semester GST 201 CIT 211 GST 203 CIT 213 CIT 215 CIT 237 MTH 211 MTH 213 MTH 241 MTH 281 Course Titles Unit(s) Status Nigerian Peoples and Cultures Introduction to Operating Systems Introduction to Philosophy and Logic Elementary Data Processing Introduction to Programming Languages Programming & Algorithms Introduction to Set Theory and Abstract Algebra Numerical Analysis I Introduction to

Programming Computers

793 words - 4 pages The Importance of Programming Logics and Designs “Computers” Abstract Having to consider the uses of computers, people use them in a wide variety of ways. In business computers track inventories with bar codes and scanners, check the credit status of customers, and transfer funds electronically. In homes, there tiny computers included in different appliances. In automobiles, computers regulate many different functions

Linear Programming

4364 words - 18 pages LINEAR PROGRAMMING II 1 Linear Programming II: Minimization © 2006 Samuel L. Baker Assignment 11 is on page 16. Introduction A minimization problem minimizes the value of the objective function rather than maximizing it. Minimization problems generally involve finding the least-cost way to meet a set of requirements. Classic example -- feeding farm animals. Animals need: 14 units of nutrient A, 12 units of nutrient B, and 18 units of

C++ Programming

1220 words - 5 pages outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details. Data abstraction is a programming (and design) technique that relies on the separation of interface and implementation. Encapsulation Encapsulation is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference

Programming Final

1006 words - 5 pages Programming Final 1. The case structure lets the value of a variable or an expression determine which path of execution the program will take. It’s a multiple alternative decision structure that allows you to test the value of a variable or an expression and then use that value to determin which statement to execute. 2. The AND operator takes two Boolean expressions as operands and creates a compound Boolean expression that is true only when

C++ Programming

1665 words - 7 pages NOTES ON C++ PROGRAMMING Module 1: Pointers and Memory Management NOTES ON C++ PROGRAMMING Module 1: Pointers and Memory Management TABLE OF CONTENTS TABLE OF CONTENTS 1 OVERVIEW 4 BASIC MEMORY MANAGEMENT 5 GROUP ASSIGNMENT 6 INITIALIZATION 8 CONSTANTS 9 INCREMENT AND DECREMENT OPERATORS 10 ELSE-IF 13 SWITCH 14 LOOPS 15 EXAMPLES OF LOOPS 16 BREAK, CONTINUE 18 RETURN 19 FUNCTION DEFINITION: 21 VOID FUNCTIONS 22 FUNCTIONS

Programming Rules

4725 words - 19 pages Extreme Programming Rules Planning 1. User stories are written - User stories serve the same purpose as use cases but are not the same. They are used to create time estimates for the release planning meeting. They are also used instead of a large requirements document. User Stories are written by the customers as things that the system needs to do for them. They are similar to usage scenarios, except that they are not limited to describing

Java Programming

1150 words - 5 pages JAVA Programming PAPER Q1. A template argument is preceded by the keyword ________. ► vector ► class ► template ► type* Q2. Which of the following causes run time binding? ► Declaring object of abstract class ► Declaring pointer of abstract class ► Declaring overridden methods as non-virtual ► None of the given Q3. A function template can not be overloaded by another function

Python Programming

3794 words - 16 pages Introduction to Programming with Python 1 Outline Introduction to Python Operators & Expressions Data Types & Type Conversion Variables: Names for data Functions Program Flow (Branching) Input from the user Iteration (Looping) 2 What is Python  Python is both an interpreted, general purpose, open source, cross-platform, high level programming language.  Python uses an interpreter. This is a software

Career of Computer Programming

1046 words - 5 pages Doe 1 John Doe Professor Jane Smith Academic Success 17 December 2009 A Career in Computer Programming Computer programming is a fascinating field that includes much problem solving and logical thinking, and without it the world of computers wouldn't exist today. From seemingly simple electronic devices like wristwatches and cell phones, to massive supercomputers used for weather modeling and protein folding simulations, computer programmers

Related Essays

Programming Essay

309 words - 2 pages . Global variables make debugging difficult because they make programming hard to understand, modules that use global variables are usually dependent and you have to track down every statement. Algorithm Workbench 1. Module main() Declare userNum as Integer Display “Enter a number” Input userNum Call TimesTen(usernum) Display usernum End 5. 13.4 00.0 00.0 6. 1, 3.4 0, 0 0, 0 7. Allows changes the values of passed parameters

Computer Programming Essay

3400 words - 14 pages THE INTEGRATION OF BASIC COMPUTER PROGRAMMING IN 5TH & 6TH GRADE OF SILLIMAN UNIVERSITY Management 35: Business Research 1st Semester School Year 2014-2015 TABLE OF CONTENTS Title Page Table of Contents Lists of Charts Lists of Tables CHAPTER 1 THE PROBLEM AND ITS SCOPE Introduction Theoretical Background: I. It will promote computer literacy. A. Computer literacy definition 1. Dictionary definition 2

Programming Languages Essay

1070 words - 5 pages Assignment 1: Exploring Programming Languages 1970’s Pascal- created by Nicklaus Wirth Designed in 1968-1969 and published in 1970 Intended to teach students structured programming. Used to introduce as undergraduate courses. The first compiler was designed in Zurich for the CDC 600 mainframe computer. Small Talk- Created by Alan Kay

Programming Language Essay

595 words - 3 pages Programming Language Student’s Name Institution Affiliation Programming Language 1. A machine language involves collection of some patterns of bits that the central processing unit recognizes as instructions. Every CPU design contains its own machine language. For the microcomputer, the machine language of the CPU contains 75 instructions, and for the large mainframe computers, it