<< Chapter < Page Chapter >> Page >

Using the library, you could write a program that would compute and also draw the trajectory in a single operation. In myopinion, that would be a much cleaner solution to the assignment.

Sample program

A complete listing of the program named Svg21a.java , that was used to produce the drawing shown in Figure 2 is provided in Listing 25 near the end of the module.

This program requires access to the SVG graphics library in the file named SvgLib21.java . A complete listing of this program is shown in Listing 26 near the end of the module.

This program also requires access to the free Java Development Kit , version 6 or later, which I will also discuss later.

Finally, this program also requires access to JDOM 1.1.1 , which is free, and which I will alsodiscuss later.

Purpose of the program

The primary purpose of this program is to demonstrate the use of my SVG graphics library in the file named SvgLib21 . It uses that library to draw an abbreviated version of a mass-pulley system shown in Figure 4 of the module thatyou will find here .

The drawing in that module contains several lines of text. However, this program draws only one line of text. Otherwise,the drawing produced by this program is the same as the drawing used inthat module titled Force and Motion -- Units of Force .

I created the original drawing using Inkscape . I created this drawing usingmy SVG graphics library and the program that I am about to discuss.

This program was tested using J2SE 6, JDOM 1.1.1, and Firefox 5 running under Windows Vista Home Premium Edition.

Beginning of the program named Svg21a.java

I will explain this program in fragments and explain how you can write similar programs to create the SVG drawing files that you need. The firstfragment, which shows the beginning of the program, is shown in Listing 2 .

(Note that complete listings are provided in Listing 25 , Listing 26 , and Listing 27 . That code is ready to copy into your editor, save as Java source code files, compile, and run as explained under Writing, compiling, and running Java programs .)

Listing 2 . Beginning of the program named Svg21a.java.
import java.io.*; import org.jdom.*;public class Svg21a{ public static void main(String[]args){ //DO NOT MODIFY ANY OF THE CODE ABOVE THIS LINE.//##################################################//

Java comments

Whenever you see the following character sequence, //, in a Java program, the text that follows to the end of the line is a comment. That is to say, that textis meant to provide information to a human reader and is ignored by the computer.

Listing 2 contains two comments. I will use many more comments in subsequent listings to help explain the code.

Java program files

Java programs are simply text files with the file name of your choice and an extension of .java. You can create those files using any plain text editor. I will explain later how youcan "compile" those files to createexecutable programs.

If this were a module on computer programming, I would explain what is meant by the program code in Listing 2 . However, since this is not a module on computer program, I will simply tell you to replicate the text shown in Listing 2 at the beginning of your Java program file with one exception. That exception has to do with the name of the program and the name of the file.

Questions & Answers

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Accessible physics concepts for blind students. OpenStax CNX. Oct 02, 2015 Download for free at https://legacy.cnx.org/content/col11294/1.36
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible physics concepts for blind students' conversation and receive update notifications?

Ask