<< 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

how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
what is inflammation
Shelly Reply
part of a tissue or an organ being wounded or bruised.
Wilfred
what term is used to name and classify microorganisms?
Micheal Reply
Binomial nomenclature
adeolu
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