Usetutoringspotscode to get 8% OFF on your first order!

  • time icon24/7 online - support@tutoringspots.com
  • phone icon1-316-444-1378 or 44-141-628-6690
  • login iconLogin

Unit 6: Programming: Console Applications, Exam 4

Unit 6
Unit 6 – Programming: Algorithms and Console Applications
Objectives
If you do well, by the end of this unit you should be able to
Understand what a program is and how it can be developed
Identify various levels of programming languages
Identify fundamental concepts about the structure of a program including algorithms and
pseudocode
Understand types of variables and how they are used
Identify Java operators
Understand various control structures used in programming
Write simple computer programs
Overview
This unit represents a survey of programming concepts, and high-level programming
languages. Students will learn about various levels of programming languages, about
programs in general, and they will acquire skills in designing and implementing small
programs, by creating algorithms, and writing the source code in a specific high level
programming language.
The same ideas govern graphics programming and old-fashioned text-based
programming, but programming with pictures is a lot more fun. It’s more challenging,
too! And one of the great things about programming is that when you wonder, Can I do
[insert wild idea here] in my program? – more often than not, you can.
The assessment associated with this unit includes a discussion that is meant to
demonstrate the use of algorithms, and a number of small programs, that would give
basic skills in designing algorithms and writing programs.
In this unit, students will participate in the following activities:
Reading: read materials presented in this unit.
Assignment: complete the assignment consisting in creating the algorithms and
writing the source code for solving the indicated problems.
Communication: Respond to the discussion topic regarding the creation of an
algorithm for a basic daily activity, such as preparation for going to bed.
Self-Study Quiz: Answer the six questions regarding the material covered in this
unit. Check the result at the end of your test, and read again the topics that you
did not get correct responses for.
Share Experience: show your masterpiece to the class on the Show Room
forum!
NOTE:
The expectation is that for students to download Java Developer Kit on their computers,
and use a simple Interface Development Environment to write, compile and run the
application. There is always the possibility to write the programs using Notepad, compile
and run them at MS-DOS command, but may prove to be unfriendly. We recommend
Textpad as IDE, but students may find JGrasp, Eclipse or any other program they may
be familiar with.
Activity 6.1
Activity 6.1 – Reading
Directions
The following readings and Web media resources should clarify the concepts needed to
achieve the learning objectives of this unit. Students are encouraged to identify
additional resources and use them for better understanding of the subject.
Understand what a program is and how it can be developed
1. Web media resource: watch the video posted at the following link to understand
concepts of software design and integration: http://youtu.be/r5Ko3H8smks
Learn about various levels of programming languages
1. Reading: go over the lecture presented at the following link, and learn about low
level and high level programming languages, and how they differ:

Languages
Learn fundamental concepts about the structure of a program including algorithms
and pseudocode
1. Web media resource: watch the following movie to learn how to build a simple
algorithm using pseudocode: http://youtu.be/j9ohod3K7HA
2. Web media resource: watch the following movie to learn how to build a simple
algorithm using pseudocode: https://www.youtube.com/watch?
v=ceQI9cmWIN8&feature=share&list=UUjlyh90bbeLU-ujRLMtZ6dw
3. Web media resources: go over the videos presented by Stanford University on
YouTube presenting a live programming class, and discuss programming
methodologies, at the following link: https://www.youtube.com/view_play_list?
p=84A56BC7F4A1F852
Learn about variables and how they are used, as well as Java operators
1. Reading: go over the tutorials presenting basic concepts of Java at
http://freejavaguide.com/corejava1.htm
2. Reading: follow the tutorials presented at the following link for information about
operators of different kinds in Java: http://freejavaguide.com/corejava2.htm
Understand various control structures used in programming
1. Reading: follow the tutorials presented at the following link
http://freejavaguide.com/corejava2.htm to learn about conditions and loops in
Java
2. Web media resource: watch the following video to understand about the while
loop: https://www.youtube.com/watch?
v=kBaAwEkE8A8&feature=share&list=UUjlyh90bbeLU-ujRLMtZ6dw
3. Web media resource: watch the following video to understand about the while
loop: https://www.youtube.com/watch?
v=o8RKwQEgLjU&feature=share&list=UUjlyh90bbeLU-ujRLMtZ6dw
4. Web media resource: watch the following video to understand nested loops, at
https://www.youtube.com/watch?v=gD82dZUoqA&
feature=share&list=UUjlyh90bbeLU-ujRLMtZ6dw
Write simple computer programs:
1. Reading: go through the following tutorial to learn how to install Java
Development Kit:
http://www3.ntu.edu.sg/home/ehchua/programming/howto/JDK_Howto.html
2. Interactive reading: browse the slides presented at the following link trying to
respond to the questions posted on selected slides:
http://chortle.ccsu.edu/java5/Notes/chap05/ch05_1.html
3. Web media resource: watch the video posted at the following link to learn how to
create and run your first program: http://youtu.be/eQ-tBQYjUDc
Additional Resources
1. Java Programming Videos
2. Discussion of Display10NumberedLines.java
3. Installing, Configuring, and Using Java and TextPad
Warning: All links are setup to open in new tabs or windows. In order to have them work,
you may need to deactivate the popups blocker on your browser.
Terms of use: All resources indicated in our course have the copyright and terms of
used displayed in the respective Web page. Please respect the conditions indicated for
each of them.
Important Note: If you find any broken links, or you have any questions in using the
materials presented above, please post your findings and concerns in the Open Forum.
Grading
The reading assignments are not graded.
Activity 6.2
Activity 6.2 – Online Discussion
Purpose
This activity is meant to help students understand the way algorithms are built, based on
simple daily life application.
Directions
Create an algorithm, and draw a structured flowchart or write structured pseudocode
describing a task that you execute every day. For example, think about your preparation
to go to bed at night. Include at least two decisions and two loops. Evaluate the effort of
writing an algorithm that would guide a robot executing all the routine activities that you
do daily.
Post your response on the discussion forum titled “Unit 6: Programming” by clicking on
the Discussion Board link in the course menu.
You have to post your direct response to the main topic, read the colleagues’ postings,
and make comments to at least two of them. Comments should bring constructive ideas
into the discussion, and you are required to respect the netiquette in all your online
interactions.
Grading
This assignment is worth 20 points toward your course total grade. Refer to the grading
rubric in Unit 1 to understand how this assignment will be graded.
Activity 6.3
Activity 6.3 – Assignment – Programming: console
applications
Purpose
Use programming concepts common to all computer languages.
Create algorithms that communicate with perfect clarity what a user is to do.
Directions
You are to create the algorithms that solve the following problems. Implement the algorithms in Java,
or any other programming language that you are familiar with.
Problem 1: Hypotenuse
Create the algorithm, and implement the program that finds the hypotenuse of a right
triangle, given the lengths of its legs.
Brief Description: Given the lengths of its legs, find the hypotenuse of a right triangle.
Notes:
The formula for the sides of a right triangle (c2 = a2 + b2) where c is the hypotenuse and
a, b are the sides. Thus c = .square root (a2 + b2). You will need to use the Math.sqrt
Java function to extract the square root.
1. Your program will display the introductory text, prompt the user for and get the
value for the first leg, prompt the user for and get the value for the second leg,
calculate the hypotenuse, display the phrase “Length of the hypotenuse:”
concatenated with the value of the hypotenuse, and then display the phrase
“Program end.”
2. You will need to use the Scanner since you are getting input from the keyboard.
Your program’s dialog could go like this:
This program asks you for the lengths
of two legs of a right triangle,
then computes the length of the hypotenuse
using the Pythagorean theorem.
Length of the first leg? 3
Length of the second leg? 4
Length of the hypotenuse: 5
Program end.
This is a sample run: the 3 and 4 are sample inputs. Your program should produce, for
example, 13 as the result of inputs 5 and 12, or 1.414213562373095048801688724
(more or less) for inputs 1 and 1. Assume that the user will enter positive values.
Problem 2: Power
Create the algorithm, and implement the program that prints the first integer numbers
raised to power 2. The printed sequence will be 1 2, 2 2, 3 2, …, 10 2.
Brief Description: This program computes the power of a range of 10 numbers using an
exponent.
1. Create the algorithm that solves this problem.
2. You will need to use the Math.pow() function to compute the power.
Program 3: Triangle
Write a program that asks the user for a positive integer, then creates a triangle that has
stars in each row from 1 up to the user’s number. For example, if the user’s number is 5,
then the program creates this triangle:
*
**
***
****
*****
Brief Description: This program asks the use for a number and then displays a triangle
of stars. Row 1 starts with 1 star and each successive row adds another star until the
number of stars displayed equals the number the user inputs.
Notes:
1. Your program should display a description of the program, prompt and get a
number from the user, and display the star triangle, and display the message “End
of program.”
2. You will need to use the Scanner since you are getting input from the keyboard.
See sample programs in Addition Resources.
3. You will need to use a loop since you do not know how man rows or stars to
display. Two nested for loops would work well here.
Program 4: Average
Write a program that asks the user to enter numbers, one at a time, and then finds their
average. It is not determined in advance how many numbers the user enters: the user
should enter a sentinel value, such as the letter Q, to indicate the end of the list.
Brief Description: Your program asks the user to enter numbers one at a time and then
finds the average of the numbers. The use enters a sentinel value like a Q to terminate
the list.
Notes:
1. You will need to use the Scanner since you are getting input from the keyboard.
See sample programs in Addition Resources.
2. You will want to use a loop like a while loop based on the sentinel as the
condition.
3. You will also need an if…else statement to help determine if you need to calculate
the average.
Copy and paste all four .java programs into a single submission using the link, Submit
Console Applications, below.
Grading
This assignment is worth 40 points total. Each program is worth 10 points. Program
elements are graded according to the following criteria:
clear algorithm 0 – 2 points
legibility and clarity of code 0 – 2 points
correctness of calculation 0 – 4 points
Total 8 points
Assignment 6.3 Submit Console Applications
Activity 6.4
Activity 6.4 – Assignment – Final Project
Purpose
Write a program shows the programming concepts learned in this class.
Use new ideas you’ve learned about computing this semester.
Directions
For this project you have two alternatives.
Write a program that solves any of the problems listed in the following file (Unit 6
Project Specifications PDF)
Your program must include:
at least one decision statement (if, if-else, or switch)
at least one repetition statement( for, while or do while loop)
Submission
Submit the following documents at the completion of your project:
Documentation of the project, containing the algorithm, produced in pseudocode
or flowchart
All files that are part of the project, including source code with the appropriate
internal documentation
A file containing snapshots of the running program, or a short video showing the
running program.
Grading
The project is worth 80 points, and the grading will be done according to the following
rubric:
# Criteria
Available
Criterion
Score
1 Create a clear algorithm that solves the
problem 10
2 Declare variables and use them in the
appropriate way 10
3 Use arithmetic and logic in the
appropriate way 10
4 Use the appropriate data types 10
5 Use the appropriate control structures 10
6
Program source code compiles and
executes using command line
instructions
10
7 Program executes according to
specifications 10
8 Program logic is well documented 10
Total Score 80
Assignment 6.4 Submit Final Project
Activity 6.5
Activity 6.5 – Self-Study Quiz
Directions
Complete the self-study quiz for this unit by clicking the link found at the bottom of the
screen. The self-study quizzes are open-book quizzes that you can take as many times as
you wish. If your score is low, use the learning resources for this week to practice your
understanding and recall, then repeat the quiz and see if your score improves.
The quiz is objective, with unlimited attempts, and it presents questions from the materials
presented in Unit 6.
Grading
The self-study quizzes are not graded.
Self-Study Quiz 6
Activity 6.6
Activity 6.6 – Show Room
Directions
Feel proud of your work? Show off a little! Share your masterpiece to the class on the Show
Room forum!
Grading
The Show Room postings are class participation and contribution extra credit. Find
the detailed directions in Unit 1 to understand how this forum will be graded.

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Unit 6: Programming: Console Applications, Exam 4

Unit 6
Unit 6 – Programming: Algorithms and Console Applications
Objectives
If you do well, by the end of this unit you should be able to
Understand what a program is and how it can be developed
Identify various levels of programming languages
Identify fundamental concepts about the structure of a program including algorithms and
pseudocode
Understand types of variables and how they are used
Identify Java operators
Understand various control structures used in programming
Write simple computer programs
Overview
This unit represents a survey of programming concepts, and high-level programming
languages. Students will learn about various levels of programming languages, about
programs in general, and they will acquire skills in designing and implementing small
programs, by creating algorithms, and writing the source code in a specific high level
programming language.
The same ideas govern graphics programming and old-fashioned text-based
programming, but programming with pictures is a lot more fun. It’s more challenging,
too! And one of the great things about programming is that when you wonder, Can I do
[insert wild idea here] in my program? – more often than not, you can.
The assessment associated with this unit includes a discussion that is meant to
demonstrate the use of algorithms, and a number of small programs, that would give
basic skills in designing algorithms and writing programs.
In this unit, students will participate in the following activities:
Reading: read materials presented in this unit.
Assignment: complete the assignment consisting in creating the algorithms and
writing the source code for solving the indicated problems.
Communication: Respond to the discussion topic regarding the creation of an
algorithm for a basic daily activity, such as preparation for going to bed.
Self-Study Quiz: Answer the six questions regarding the material covered in this
unit. Check the result at the end of your test, and read again the topics that you
did not get correct responses for.
Share Experience: show your masterpiece to the class on the Show Room
forum!
NOTE:
The expectation is that for students to download Java Developer Kit on their computers,
and use a simple Interface Development Environment to write, compile and run the
application. There is always the possibility to write the programs using Notepad, compile
and run them at MS-DOS command, but may prove to be unfriendly. We recommend
Textpad as IDE, but students may find JGrasp, Eclipse or any other program they may
be familiar with.
Activity 6.1
Activity 6.1 – Reading
Directions
The following readings and Web media resources should clarify the concepts needed to
achieve the learning objectives of this unit. Students are encouraged to identify
additional resources and use them for better understanding of the subject.
Understand what a program is and how it can be developed
1. Web media resource: watch the video posted at the following link to understand
concepts of software design and integration: http://youtu.be/r5Ko3H8smks
Learn about various levels of programming languages
1. Reading: go over the lecture presented at the following link, and learn about low
level and high level programming languages, and how they differ:

Languages
Learn fundamental concepts about the structure of a program including algorithms
and pseudocode
1. Web media resource: watch the following movie to learn how to build a simple
algorithm using pseudocode: http://youtu.be/j9ohod3K7HA
2. Web media resource: watch the following movie to learn how to build a simple
algorithm using pseudocode: https://www.youtube.com/watch?
v=ceQI9cmWIN8&feature=share&list=UUjlyh90bbeLU-ujRLMtZ6dw
3. Web media resources: go over the videos presented by Stanford University on
YouTube presenting a live programming class, and discuss programming
methodologies, at the following link: https://www.youtube.com/view_play_list?
p=84A56BC7F4A1F852
Learn about variables and how they are used, as well as Java operators
1. Reading: go over the tutorials presenting basic concepts of Java at
http://freejavaguide.com/corejava1.htm
2. Reading: follow the tutorials presented at the following link for information about
operators of different kinds in Java: http://freejavaguide.com/corejava2.htm
Understand various control structures used in programming
1. Reading: follow the tutorials presented at the following link
http://freejavaguide.com/corejava2.htm to learn about conditions and loops in
Java
2. Web media resource: watch the following video to understand about the while
loop: https://www.youtube.com/watch?
v=kBaAwEkE8A8&feature=share&list=UUjlyh90bbeLU-ujRLMtZ6dw
3. Web media resource: watch the following video to understand about the while
loop: https://www.youtube.com/watch?
v=o8RKwQEgLjU&feature=share&list=UUjlyh90bbeLU-ujRLMtZ6dw
4. Web media resource: watch the following video to understand nested loops, at
https://www.youtube.com/watch?v=gD82dZUoqA&
feature=share&list=UUjlyh90bbeLU-ujRLMtZ6dw
Write simple computer programs:
1. Reading: go through the following tutorial to learn how to install Java
Development Kit:
http://www3.ntu.edu.sg/home/ehchua/programming/howto/JDK_Howto.html
2. Interactive reading: browse the slides presented at the following link trying to
respond to the questions posted on selected slides:
http://chortle.ccsu.edu/java5/Notes/chap05/ch05_1.html
3. Web media resource: watch the video posted at the following link to learn how to
create and run your first program: http://youtu.be/eQ-tBQYjUDc
Additional Resources
1. Java Programming Videos
2. Discussion of Display10NumberedLines.java
3. Installing, Configuring, and Using Java and TextPad
Warning: All links are setup to open in new tabs or windows. In order to have them work,
you may need to deactivate the popups blocker on your browser.
Terms of use: All resources indicated in our course have the copyright and terms of
used displayed in the respective Web page. Please respect the conditions indicated for
each of them.
Important Note: If you find any broken links, or you have any questions in using the
materials presented above, please post your findings and concerns in the Open Forum.
Grading
The reading assignments are not graded.
Activity 6.2
Activity 6.2 – Online Discussion
Purpose
This activity is meant to help students understand the way algorithms are built, based on
simple daily life application.
Directions
Create an algorithm, and draw a structured flowchart or write structured pseudocode
describing a task that you execute every day. For example, think about your preparation
to go to bed at night. Include at least two decisions and two loops. Evaluate the effort of
writing an algorithm that would guide a robot executing all the routine activities that you
do daily.
Post your response on the discussion forum titled “Unit 6: Programming” by clicking on
the Discussion Board link in the course menu.
You have to post your direct response to the main topic, read the colleagues’ postings,
and make comments to at least two of them. Comments should bring constructive ideas
into the discussion, and you are required to respect the netiquette in all your online
interactions.
Grading
This assignment is worth 20 points toward your course total grade. Refer to the grading
rubric in Unit 1 to understand how this assignment will be graded.
Activity 6.3
Activity 6.3 – Assignment – Programming: console
applications
Purpose
Use programming concepts common to all computer languages.
Create algorithms that communicate with perfect clarity what a user is to do.
Directions
You are to create the algorithms that solve the following problems. Implement the algorithms in Java,
or any other programming language that you are familiar with.
Problem 1: Hypotenuse
Create the algorithm, and implement the program that finds the hypotenuse of a right
triangle, given the lengths of its legs.
Brief Description: Given the lengths of its legs, find the hypotenuse of a right triangle.
Notes:
The formula for the sides of a right triangle (c2 = a2 + b2) where c is the hypotenuse and
a, b are the sides. Thus c = .square root (a2 + b2). You will need to use the Math.sqrt
Java function to extract the square root.
1. Your program will display the introductory text, prompt the user for and get the
value for the first leg, prompt the user for and get the value for the second leg,
calculate the hypotenuse, display the phrase “Length of the hypotenuse:”
concatenated with the value of the hypotenuse, and then display the phrase
“Program end.”
2. You will need to use the Scanner since you are getting input from the keyboard.
Your program’s dialog could go like this:
This program asks you for the lengths
of two legs of a right triangle,
then computes the length of the hypotenuse
using the Pythagorean theorem.
Length of the first leg? 3
Length of the second leg? 4
Length of the hypotenuse: 5
Program end.
This is a sample run: the 3 and 4 are sample inputs. Your program should produce, for
example, 13 as the result of inputs 5 and 12, or 1.414213562373095048801688724
(more or less) for inputs 1 and 1. Assume that the user will enter positive values.
Problem 2: Power
Create the algorithm, and implement the program that prints the first integer numbers
raised to power 2. The printed sequence will be 1 2, 2 2, 3 2, …, 10 2.
Brief Description: This program computes the power of a range of 10 numbers using an
exponent.
1. Create the algorithm that solves this problem.
2. You will need to use the Math.pow() function to compute the power.
Program 3: Triangle
Write a program that asks the user for a positive integer, then creates a triangle that has
stars in each row from 1 up to the user’s number. For example, if the user’s number is 5,
then the program creates this triangle:
*
**
***
****
*****
Brief Description: This program asks the use for a number and then displays a triangle
of stars. Row 1 starts with 1 star and each successive row adds another star until the
number of stars displayed equals the number the user inputs.
Notes:
1. Your program should display a description of the program, prompt and get a
number from the user, and display the star triangle, and display the message “End
of program.”
2. You will need to use the Scanner since you are getting input from the keyboard.
See sample programs in Addition Resources.
3. You will need to use a loop since you do not know how man rows or stars to
display. Two nested for loops would work well here.
Program 4: Average
Write a program that asks the user to enter numbers, one at a time, and then finds their
average. It is not determined in advance how many numbers the user enters: the user
should enter a sentinel value, such as the letter Q, to indicate the end of the list.
Brief Description: Your program asks the user to enter numbers one at a time and then
finds the average of the numbers. The use enters a sentinel value like a Q to terminate
the list.
Notes:
1. You will need to use the Scanner since you are getting input from the keyboard.
See sample programs in Addition Resources.
2. You will want to use a loop like a while loop based on the sentinel as the
condition.
3. You will also need an if…else statement to help determine if you need to calculate
the average.
Copy and paste all four .java programs into a single submission using the link, Submit
Console Applications, below.
Grading
This assignment is worth 40 points total. Each program is worth 10 points. Program
elements are graded according to the following criteria:
clear algorithm 0 – 2 points
legibility and clarity of code 0 – 2 points
correctness of calculation 0 – 4 points
Total 8 points
Assignment 6.3 Submit Console Applications
Activity 6.4
Activity 6.4 – Assignment – Final Project
Purpose
Write a program shows the programming concepts learned in this class.
Use new ideas you’ve learned about computing this semester.
Directions
For this project you have two alternatives.
Write a program that solves any of the problems listed in the following file (Unit 6
Project Specifications PDF)
Your program must include:
at least one decision statement (if, if-else, or switch)
at least one repetition statement( for, while or do while loop)
Submission
Submit the following documents at the completion of your project:
Documentation of the project, containing the algorithm, produced in pseudocode
or flowchart
All files that are part of the project, including source code with the appropriate
internal documentation
A file containing snapshots of the running program, or a short video showing the
running program.
Grading
The project is worth 80 points, and the grading will be done according to the following
rubric:
# Criteria
Available
Criterion
Score
1 Create a clear algorithm that solves the
problem 10
2 Declare variables and use them in the
appropriate way 10
3 Use arithmetic and logic in the
appropriate way 10
4 Use the appropriate data types 10
5 Use the appropriate control structures 10
6
Program source code compiles and
executes using command line
instructions
10
7 Program executes according to
specifications 10
8 Program logic is well documented 10
Total Score 80
Assignment 6.4 Submit Final Project
Activity 6.5
Activity 6.5 – Self-Study Quiz
Directions
Complete the self-study quiz for this unit by clicking the link found at the bottom of the
screen. The self-study quizzes are open-book quizzes that you can take as many times as
you wish. If your score is low, use the learning resources for this week to practice your
understanding and recall, then repeat the quiz and see if your score improves.
The quiz is objective, with unlimited attempts, and it presents questions from the materials
presented in Unit 6.
Grading
The self-study quizzes are not graded.
Self-Study Quiz 6
Activity 6.6
Activity 6.6 – Show Room
Directions
Feel proud of your work? Show off a little! Share your masterpiece to the class on the Show
Room forum!
Grading
The Show Room postings are class participation and contribution extra credit. Find
the detailed directions in Unit 1 to understand how this forum will be graded.

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes