CS 110 WVU Java Program Creation that Performs Specified Actions Lab - Programming
To do the lab follow the attachment Lab4I also attached Lab4 presentation to explain the lab
lab_4_presentation.pdf
lab_assignment_4.pdf
Unformatted Attachment Preview
CS 110 Lab 4
Constants
Constants in Java
• Constants are identified with the
reserved word final
• A variable tagged as final can
never change after it has been
set
• If you try to change the value of
a final variable, the compiler will
report an error and your
program will not compile
Example using Constants
• All constants must use the
keyword final and have a
datatype
• The name of the constant
should be in upper case with
underscores between words
like: IN_UPPER_CASE
Java Formatted Print Statements
Format Specifiers
• Format specifiers begin with a
percent character (\%) and
terminate ith a t pe
character
hich indicates the
type of data
• \%s string values
• \%d integer
• \%f floating point
Format Specifiers Must Match Arguments
• Format specifiers must appear
within a string literal
• The values to insert in the
format specifiers must occur in
the order the variables listed
after the string occur
• Example:
• You cannot use a \%d format
specifier to output a string value
Formatted Print
Statements
• System.out.printf() must be
used to print a formatted string
• Printf() does not append a new
line to the end of a string
• Use \n to print something on a
new line using printf()
Variable Scope
Variable Scope 1/2
• Scope of a variable is the part of
the program where the variable
is accessible.
• A method cannot access a
variable from another method
Variable Scope 2/2
• Methods cannot access a
variable from another method
even if the variable names are
identical
• Variables within a method are
local (only accessible within the
method)
Translating Mathematical
Formulas to Java Syntax
Calculating Slope of a Line
• 𝑠𝑙𝑜𝑝𝑒
• We cannot use a long horizontal
bar for division in Java,
• we must put () around everything
on top of the division and put
another set of () around
everything on the bottom
Pythagorean Theorem
• The Pythagorean theorem for
right triangles:
•𝑎
𝑏
𝑐
• Solve for c
•𝑐
𝑎
𝑏
• In Java:
•
= Math.sqrt()
• Everything under the square root
symbol must be in ()
•
= Math.pow
, 2)
Expressing
in Java
• A operator does not exist in Java.
• However, you can break it into two
equations where you use + for one
equation and you use for the
other equation
• Example:
• a = b c in Java must be broken into
two statements: a = b + c and a = b
c
• Use two variables to store the result
this Reference
this Reference
• When you refer to an instance
variable inside a method, it
means the instance variable of
the implicit parameter.
• You can access an implicit
parameter with the reserved
word this.
• The this reference is used to
distinguish between instance
variables and local or parameter
variables of the same name.
JavaDoc Documentation
Comments
Documenting Methods 1/2
• When you implement classes
and methods, you should add
comments about their behaviors
• Documentation comments are
placed before the class or
method declaration and starts
with a /**
• Press alt + shift + j to insert a
JavaDoc comment.
Documenting Methods 2/2
• The javadoc utility copies the
first sentence of each comment
to a summary table.
• The sentence should start with
an uppercase letter and end
with a period.
• It does not have to be a
grammatically complete
sentence, but it should be
meaningful when it is displayed
in a summary.
CS 110 >> Introduction to Computer Science
Summer 2020
Lab Assignment 4
T OPICS
Constants
This reference
Variable scope
Translating mathematical formulas to Java
Syntax
Formatted output using printf method
I NSTRUCTIONS
Complete each problem by creating a Java program that performs the specified action. The Eclipse IDE is strongly
recommended but not required. This assignment will cover the following: creating a main function in Java and
using print statements to print text out to the console.
For this assignment, you will write a program to calculate the volume and surface area of the Pyramid of Khufu
in Egypt and print the calculations to the console.
IMPORTANT: Complete the below steps in the order they are given. Completing the steps out of order may
complicate the assignment or result in an incorrect result.
P ROBLEM 1
1. Create a Java class called Pyramid.java
2. At the top of your .java file add the following documentation comments. Replace the italicized text with
the appropriate content.
/**
@author Your Name
CS110 Section 02
Lab Assignment 4
Todays Date
*
*
*
*
*/
3. Create two private instance variables of type double to store the height and the length of the base of a
pyramid using variable names of your choice.
4. Create a constructor for Pyramid.java. The constructor should take two parameters of type double
representing the height and length of the base of a pyramid. In the body of the constructor use the
parameters to initialize the values of the instance variables created in step 3 using the appropriate
parameter.
5. Create a method with the signature public double getVolume(). The purpose of this method is
to calculate the volume of the pyramid using the instance variables containing the height and length of
rev. May 26 – 1 / 4
6.
the base of the pyramid and return the calculation. See Figure 1: Surface Area and Volume of Pyramid
for the formula to calculate the volume of a pyramid.
Create a method with the signature pubic double getSurfaceArea(). The purpose of this
method is to calculate the surface area of the pyramid using the instance variables containing the
height and length of the base of the pyramid and return the calculation. See Figure 1: Surface Area and
Volume of Pyramid for the formula to calculate the surface area of a pyramid.
H I NT :
YOU W I L L NE E D T O CAL CUL AT E T HE L E NGT H OF T HE S I D E OF T HE P Y R A M I D I N OR D E R T O C AL CUL AT E
T HE S URF AC E ARE A .
Figure 1: Surface Area and Volume of Pyramid
7. Create a Java class called PyramidCalculator.java in the same Java project folder as
Pyramid.java.
8. At the top of your .java file add the following documentation comments. Replace the italicized text with
the appropriate content.
/**
@author Your Name
CS110 Section 02
Lab Assignment 4
Todays Date
*
*
*
*
*/
9. Create two constants of type double to store the height of length of the base of the Pyramid of Khufu.
a. The length of the base of the Pyramid of Khufu is 230.34 meters.
b. The length of the height of the Pyramid of Khufu is 146.7 meters.
10. Add a main method to PyramidCalculator.java. In the main method, do the following:
a. Create an instance of the Pyramid class named pyramidOfKhufu.
b. Use the printf me h d
in he ing li e al The a
ima e l me f he P amid f
Kh f i f ll ed b he l me f he
amid
calc la e ing he al e
ed in he
constants containing the height and length of the base of the pyramid followed by the string
li e al c bic me e
See Figure 2: Example Output for an example.
2/4
CS 110 >> Introduction to Computer Science
Summer 2020
Lab Assignment 4
c. Use the printf me h d
in he ing li e al The a
ima e face a ea f he
P amid f Kh f i f ll ed b he face a ea f he
amid
calc la e ing he values
stored in the constants containing the height and length of the base of the pyramid followed by
he ing li e al
a e me e
See Figure 2: Example Output for an example.
Figure 2: Example Output
S UBMISSION
Any questions about the assignment itself or errors you may find in your code can always be addressed towards
myself via email or in-person. You will submit a zip file named lab4.zip containing Pyramid.java and
PyramidCalculator.java to eCampus when complete. This assignment is due Wednesday, May 27, 2020 by 10:00
PM ET however, it can be submitted earlier if complete.
M AKE S URE T O S UBM I T T HE . J AVA F I L E AND NOT
T HE . CL AS S F I L E YOU W I L L RE CE I VE NO CRE DI T .
T HE
.CLASS
F I L E W HE N S U B M I T T I NG Y O UR W OR K .
IF
YOU SUBMIT
G RADING R UBRIC
This assignment is worth 10 points. It will be graded by your instructor using this rubric:
Criteria
Excellent
Good
Fair
Poor
Unsatisfactory
(2 points)
(1.5 points)
(1 point)
(0.5 point)
(0 points)
Program source file
is documented
correctly
Program source file
is not missing any
required
documentation
Program source
file is missing one
required comment
Program source
file is missing less
than half of the
required
comments
Program source
file is missing
most of the
documentation
Program source file
contains no
documentation
Program source file
follows coding
standards
Program follows all
coding standards
Program follows
most coding
standards
Program follows
some coding
standards
Program follows
only a few coding
standards
Program does not
follow any coding
standards
Program Output
Program output
meets instructional
requirements with
no errors
Program output
meets most
instructional
requirements with
minor errors
Program output
meets some
instructional
requirements with
moderate errors
Program output
meets only a few
instructional
requirements
with major errors
Program output does
not meet any
instructional
requirements
rev. May 26 – 3 / 4
Program execution
performs according
to assignment
specifications
Program executes
correctly with no
syntax or runtime
errors
Program executes
with a minor error
(one easily fixed
error)
Program executes
with moderate
error (few easily
fixed errors)
Program executes
with major errors
(significant
revision to fix
error)
Program does not
execute
Program is wellorganized and is
highly readable
Program is
stylistically well
designed
Few inappropriate
design choices (i.e.
poor variable
names, improper
indentation)
Several
inappropriate
design choices (i.e.
poor variable
names, improper
indentation)
Program is poorly
written
Program contains no
organization
S OURCES
Great Pyramid of Giza Wikipedia: The Free Encyclopedia. Wikimedia Foundation, Inc. 7 May 2020. Web. 18
May 2020, https://en.wikipedia.org/wiki/Great_Pyramid_of_Giza.
4/4
...
Purchase answer to see full
attachment
CATEGORIES
Economics
Nursing
Applied Sciences
Psychology
Science
Management
Computer Science
Human Resource Management
Accounting
Information Systems
English
Anatomy
Operations Management
Sociology
Literature
Education
Business & Finance
Marketing
Engineering
Statistics
Biology
Political Science
Reading
History
Financial markets
Philosophy
Mathematics
Law
Criminal
Architecture and Design
Government
Social Science
World history
Chemistry
Humanities
Business Finance
Writing
Programming
Telecommunications Engineering
Geography
Physics
Spanish
ach
e. Embedded Entrepreneurship
f. Three Social Entrepreneurship Models
g. Social-Founder Identity
h. Micros-enterprise Development
Outcomes
Subset 2. Indigenous Entrepreneurship Approaches (Outside of Canada)
a. Indigenous Australian Entrepreneurs Exami
Calculus
(people influence of
others) processes that you perceived occurs in this specific Institution Select one of the forms of stratification highlighted (focus on inter the intersectionalities
of these three) to reflect and analyze the potential ways these (
American history
Pharmacology
Ancient history
. Also
Numerical analysis
Environmental science
Electrical Engineering
Precalculus
Physiology
Civil Engineering
Electronic Engineering
ness Horizons
Algebra
Geology
Physical chemistry
nt
When considering both O
lassrooms
Civil
Probability
ions
Identify a specific consumer product that you or your family have used for quite some time. This might be a branded smartphone (if you have used several versions over the years)
or the court to consider in its deliberations. Locard’s exchange principle argues that during the commission of a crime
Chemical Engineering
Ecology
aragraphs (meaning 25 sentences or more). Your assignment may be more than 5 paragraphs but not less.
INSTRUCTIONS:
To access the FNU Online Library for journals and articles you can go the FNU library link here:
https://www.fnu.edu/library/
In order to
n that draws upon the theoretical reading to explain and contextualize the design choices. Be sure to directly quote or paraphrase the reading
ce to the vaccine. Your campaign must educate and inform the audience on the benefits but also create for safe and open dialogue. A key metric of your campaign will be the direct increase in numbers.
Key outcomes: The approach that you take must be clear
Mechanical Engineering
Organic chemistry
Geometry
nment
Topic
You will need to pick one topic for your project (5 pts)
Literature search
You will need to perform a literature search for your topic
Geophysics
you been involved with a company doing a redesign of business processes
Communication on Customer Relations. Discuss how two-way communication on social media channels impacts businesses both positively and negatively. Provide any personal examples from your experience
od pressure and hypertension via a community-wide intervention that targets the problem across the lifespan (i.e. includes all ages).
Develop a community-wide intervention to reduce elevated blood pressure and hypertension in the State of Alabama that in
in body of the report
Conclusions
References (8 References Minimum)
*** Words count = 2000 words.
*** In-Text Citations and References using Harvard style.
*** In Task section I’ve chose (Economic issues in overseas contracting)"
Electromagnetism
w or quality improvement; it was just all part of good nursing care. The goal for quality improvement is to monitor patient outcomes using statistics for comparison to standards of care for different diseases
e a 1 to 2 slide Microsoft PowerPoint presentation on the different models of case management. Include speaker notes... .....Describe three different models of case management.
visual representations of information. They can include numbers
SSAY
ame workbook for all 3 milestones. You do not need to download a new copy for Milestones 2 or 3. When you submit Milestone 3
pages):
Provide a description of an existing intervention in Canada
making the appropriate buying decisions in an ethical and professional manner.
Topic: Purchasing and Technology
You read about blockchain ledger technology. Now do some additional research out on the Internet and share your URL with the rest of the class
be aware of which features their competitors are opting to include so the product development teams can design similar or enhanced features to attract more of the market. The more unique
low (The Top Health Industry Trends to Watch in 2015) to assist you with this discussion.
https://youtu.be/fRym_jyuBc0
Next year the $2.8 trillion U.S. healthcare industry will finally begin to look and feel more like the rest of the business wo
evidence-based primary care curriculum. Throughout your nurse practitioner program
Vignette
Understanding Gender Fluidity
Providing Inclusive Quality Care
Affirming Clinical Encounters
Conclusion
References
Nurse Practitioner Knowledge
Mechanics
and word limit is unit as a guide only.
The assessment may be re-attempted on two further occasions (maximum three attempts in total). All assessments must be resubmitted 3 days within receiving your unsatisfactory grade. You must clearly indicate “Re-su
Trigonometry
Article writing
Other
5. June 29
After the components sending to the manufacturing house
1. In 1972 the Furman v. Georgia case resulted in a decision that would put action into motion. Furman was originally sentenced to death because of a murder he committed in Georgia but the court debated whether or not this was a violation of his 8th amend
One of the first conflicts that would need to be investigated would be whether the human service professional followed the responsibility to client ethical standard. While developing a relationship with client it is important to clarify that if danger or
Ethical behavior is a critical topic in the workplace because the impact of it can make or break a business
No matter which type of health care organization
With a direct sale
During the pandemic
Computers are being used to monitor the spread of outbreaks in different areas of the world and with this record
3. Furman v. Georgia is a U.S Supreme Court case that resolves around the Eighth Amendments ban on cruel and unsual punishment in death penalty cases. The Furman v. Georgia case was based on Furman being convicted of murder in Georgia. Furman was caught i
One major ethical conflict that may arise in my investigation is the Responsibility to Client in both Standard 3 and Standard 4 of the Ethical Standards for Human Service Professionals (2015). Making sure we do not disclose information without consent ev
4. Identify two examples of real world problems that you have observed in your personal
Summary & Evaluation: Reference & 188. Academic Search Ultimate
Ethics
We can mention at least one example of how the violation of ethical standards can be prevented. Many organizations promote ethical self-regulation by creating moral codes to help direct their business activities
*DDB is used for the first three years
For example
The inbound logistics for William Instrument refer to purchase components from various electronic firms. During the purchase process William need to consider the quality and price of the components. In this case
4. A U.S. Supreme Court case known as Furman v. Georgia (1972) is a landmark case that involved Eighth Amendment’s ban of unusual and cruel punishment in death penalty cases (Furman v. Georgia (1972)
With covid coming into place
In my opinion
with
Not necessarily all home buyers are the same! When you choose to work with we buy ugly houses Baltimore & nationwide USA
The ability to view ourselves from an unbiased perspective allows us to critically assess our personal strengths and weaknesses. This is an important step in the process of finding the right resources for our personal learning style. Ego and pride can be
· By Day 1 of this week
While you must form your answers to the questions below from our assigned reading material
CliftonLarsonAllen LLP (2013)
5 The family dynamic is awkward at first since the most outgoing and straight forward person in the family in Linda
Urien
The most important benefit of my statistical analysis would be the accuracy with which I interpret the data. The greatest obstacle
From a similar but larger point of view
4 In order to get the entire family to come back for another session I would suggest coming in on a day the restaurant is not open
When seeking to identify a patient’s health condition
After viewing the you tube videos on prayer
Your paper must be at least two pages in length (not counting the title and reference pages)
The word assimilate is negative to me. I believe everyone should learn about a country that they are going to live in. It doesnt mean that they have to believe that everything in America is better than where they came from. It means that they care enough
Data collection
Single Subject Chris is a social worker in a geriatric case management program located in a midsize Northeastern town. She has an MSW and is part of a team of case managers that likes to continuously improve on its practice. The team is currently using an
I would start off with Linda on repeating her options for the child and going over what she is feeling with each option. I would want to find out what she is afraid of. I would avoid asking her any “why” questions because I want her to be in the here an
Summarize the advantages and disadvantages of using an Internet site as means of collecting data for psychological research (Comp 2.1) 25.0\% Summarization of the advantages and disadvantages of using an Internet site as means of collecting data for psych
Identify the type of research used in a chosen study
Compose a 1
Optics
effect relationship becomes more difficult—as the researcher cannot enact total control of another person even in an experimental environment. Social workers serve clients in highly complex real-world environments. Clients often implement recommended inte
I think knowing more about you will allow you to be able to choose the right resources
Be 4 pages in length
soft MB-920 dumps review and documentation and high-quality listing pdf MB-920 braindumps also recommended and approved by Microsoft experts. The practical test
g
One thing you will need to do in college is learn how to find and use references. References support your ideas. College-level work must be supported by research. You are expected to do that for this paper. You will research
Elaborate on any potential confounds or ethical concerns while participating in the psychological study 20.0\% Elaboration on any potential confounds or ethical concerns while participating in the psychological study is missing. Elaboration on any potenti
3 The first thing I would do in the family’s first session is develop a genogram of the family to get an idea of all the individuals who play a major role in Linda’s life. After establishing where each member is in relation to the family
A Health in All Policies approach
Note: The requirements outlined below correspond to the grading criteria in the scoring guide. At a minimum
Chen
Read Connecting Communities and Complexity: A Case Study in Creating the Conditions for Transformational Change
Read Reflections on Cultural Humility
Read A Basic Guide to ABCD Community Organizing
Use the bolded black section and sub-section titles below to organize your paper. For each section
Losinski forwarded the article on a priority basis to Mary Scott
Losinksi wanted details on use of the ED at CGH. He asked the administrative resident