<< 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 defense mechanism
Chinaza Reply
what is defense mechanisms
Chinaza
I'm interested in biological psychology and cognitive psychology
Tanya Reply
what does preconceived mean
sammie Reply
physiological Psychology
Nwosu Reply
How can I develope my cognitive domain
Amanyire Reply
why is communication effective
Dakolo Reply
Communication is effective because it allows individuals to share ideas, thoughts, and information with others.
effective communication can lead to improved outcomes in various settings, including personal relationships, business environments, and educational settings. By communicating effectively, individuals can negotiate effectively, solve problems collaboratively, and work towards common goals.
it starts up serve and return practice/assessments.it helps find voice talking therapy also assessments through relaxed conversation.
miss
Every time someone flushes a toilet in the apartment building, the person begins to jumb back automatically after hearing the flush, before the water temperature changes. Identify the types of learning, if it is classical conditioning identify the NS, UCS, CS and CR. If it is operant conditioning, identify the type of consequence positive reinforcement, negative reinforcement or punishment
Wekolamo Reply
please i need answer
Wekolamo
because it helps many people around the world to understand how to interact with other people and understand them well, for example at work (job).
Manix Reply
Agreed 👍 There are many parts of our brains and behaviors, we really need to get to know. Blessings for everyone and happy Sunday!
ARC
A child is a member of community not society elucidate ?
JESSY Reply
Isn't practices worldwide, be it psychology, be it science. isn't much just a false belief of control over something the mind cannot truly comprehend?
Simon Reply
compare and contrast skinner's perspective on personality development on freud
namakula Reply
Skinner skipped the whole unconscious phenomenon and rather emphasized on classical conditioning
war
explain how nature and nurture affect the development and later the productivity of an individual.
Amesalu Reply
nature is an hereditary factor while nurture is an environmental factor which constitute an individual personality. so if an individual's parent has a deviant behavior and was also brought up in an deviant environment, observation of the behavior and the inborn trait we make the individual deviant.
Samuel
I am taking this course because I am hoping that I could somehow learn more about my chosen field of interest and due to the fact that being a PsyD really ignites my passion as an individual the more I hope to learn about developing and literally explore the complexity of my critical thinking skills
Zyryn Reply
good👍
Jonathan
and having a good philosophy of the world is like a sandwich and a peanut butter 👍
Jonathan
generally amnesi how long yrs memory loss
Kelu Reply
interpersonal relationships
Abdulfatai 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