This lab aims to develop students knowledge and skills needed to create a simple programming code. It covers the process of developing computer programs starting from a simple analysis of the problem, identifying outputs, inputs, and design process/algorithm, convert algorithm to code, testing, and documentation. The student will be introduced to the Java program structure, numerical variable and high-level introduction to data types. The lab does not go into depth explaining the data types and memory storage. These will be discussed in the upcoming labs. Also, the student will be introduced to the REPL cloud environment that will be used to create a simple application.
This lab aims to develop your knowledge and skills to apply various iteration/loop technique to solve a programming problem. The lab will cover the structure of for, while and do-while loops, provide examples on when to apply each. Exceptions handling and reading from an external text file are also covered with examples.
This slide notes are more than 10 years old of my teacher Mr Karim Zebari. He uses a brilliant simple language to explain programming principles step by step.
Old Java lectures by my teacher Karim Zebari at Software Department College of Engineering University of Salahaddin-Erbil. The topics are:
- Multithreading
- Security in Java
- Java Beans
- Internationalization
- Java Servlets
- Java Server Pages
- Database access in Java
- More GUI Components & Printing
- Remote Method Invocation (RMI)
- Java Collections Framework
This lab aims to develop your knowledge and skills to apply various iteration/loop technique to solve a programming problem. The lab will cover the structure of for, while and do-while loops, provide examples on when to apply each. Exceptions handling and reading from an external text file are also covered with examples.
This slide notes are more than 10 years old of my teacher Mr Karim Zebari. He uses a brilliant simple language to explain programming principles step by step.
Old Java lectures by my teacher Karim Zebari at Software Department College of Engineering University of Salahaddin-Erbil. The topics are:
- Multithreading
- Security in Java
- Java Beans
- Internationalization
- Java Servlets
- Java Server Pages
- Database access in Java
- More GUI Components & Printing
- Remote Method Invocation (RMI)
- Java Collections Framework
OptimJ is an extension of the Java programming language with language support for writing optimization
models and powerful abstractions for bulk data processing.
Solutions manual for absolute java 5th edition by walter savitchAlbern9271
Solutions manual for absolute java 5th edition by walter savitch
Full clear download( no error formatting) at:
https://goo.gl/Aic8JR
absolute java 5th edition pdf free
absolute java 5th edition by walter savitch pdf
absolute java 5th edition solutions pdf
absolute java 6th edition solutions pdf
absolute java programming projects solutions
pearson absolute java 5th ed walter savitch 2012 pdf
walter savitch absolute java 4th edition or newer addison wesley 3rd edition is also fine
Programming is the process of taking an algorithm and encoding it into a notation, a programming language so that it can be executed by a computer. Although many programming languages and many different types of computers exist, the important first step is the need to have the solution. Without an algorithm, there can be no program.
To know more: https://hackr.io/blog/what-is-programming-language
OptimJ is an extension of the Java programming language with language support for writing optimization
models and powerful abstractions for bulk data processing.
Solutions manual for absolute java 5th edition by walter savitchAlbern9271
Solutions manual for absolute java 5th edition by walter savitch
Full clear download( no error formatting) at:
https://goo.gl/Aic8JR
absolute java 5th edition pdf free
absolute java 5th edition by walter savitch pdf
absolute java 5th edition solutions pdf
absolute java 6th edition solutions pdf
absolute java programming projects solutions
pearson absolute java 5th ed walter savitch 2012 pdf
walter savitch absolute java 4th edition or newer addison wesley 3rd edition is also fine
Programming is the process of taking an algorithm and encoding it into a notation, a programming language so that it can be executed by a computer. Although many programming languages and many different types of computers exist, the important first step is the need to have the solution. Without an algorithm, there can be no program.
To know more: https://hackr.io/blog/what-is-programming-language
<a href="https://www.a1autorecycling.com.au/car-removal-gold-coast/">Car removal gold coast</a> is the best in the cash for cars removal services provider in brisbane.
Mastering Python : 100+ Solved and Commented Exercises to Accelerate Your Lea...Lucky Gods
Ready to Unleash Your Python Power?
Tired of coding in the dark? Feeling lost in a sea of syntax errors? Well, ditch the frustration and dive headfirst into Python mastery! This book is your ultimate passport to programming paradise, packed with 100+ solved and commented exercises that'll turn you from coding rookie to confident Python pro in no time!
Imagine:
Cracking the code like a ninja: Demystifying variables, functions, loops, and more!
Conquering challenges with ease: Solving real-world problems with your newfound Python skills!
Leveling up your game: Mastering advanced concepts like data analysis and machine learning!
Sharing your Python prowess: Dazzling everyone with your coding superpowers!
This book is your roadmap to Python success:
Spark your coding curiosity: Ignite your passion for programming with engaging explanations and real-world examples.
Master the fundamentals: Build a solid foundation in Python syntax, data types, and control flow.
Practice makes perfect: Tackle 100+ challenges of varying difficulty, with clear explanations for every step.
Level up your skills: Dive deeper into object-oriented programming, data analysis, and beyond!
So, what are you waiting for? Grab this book, unlock the power of Python, and watch your coding dreams come true!
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
I have heard many times that architecture is not important for the front-end. Also, many times I have seen how developers implement features on the front-end just following the standard rules for a framework and think that this is enough to successfully launch the project, and then the project fails. How to prevent this and what approach to choose? I have launched dozens of complex projects and during the talk we will analyze which approaches have worked for me and which have not.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
2. This lab aims to develop students knowledge and skills needed to create a simple
programming code. It covers the process of developing computer programs starting
from simple analysis of problem, identify outputs, inputs, and design process/
algorithm, convert algorithm to code, testing, and documentation. The student will
be introduced to the Java program structure, numerical variable and high-level
introduction to data types. The lab does not go into depth explaining the data types
and memory storage. These will be discussed in the upcoming labs. Also, the student
will be introduced to the REPL cloud environment that will be used to create a simple
application.
Introduction
Skill-sets
By completing this lab, the student is expected to develop the following skills:
• Implement the process needed to create a simple computer code
• Identify the required inputs and outputs
• Develop a step by step process in human language explaining the solution. At this
stage, the solution does not include selections, control structure, and advanced
data types or complex arithmetic operation.
• Convert the solution from human language to Java programming language
• Use REPL.it to develop the solution
• Debug the code and fix any errors
• Create and use test data to ensure the program contains no logical errors
• Use appropriate comments to document the code
• Allow the user to enter data using the keyboard
How to use this lab?
To make the best of this lab, it is recommended to follow these steps:
• Watch the associated video (click or scan this QR code)
• Read this lab manual and follow every step
• Complete the last three exercises
• Modify these exercises to create a new solution
• Think of other problem that you can solve using the skills you accommodated in
this course.
2
3. The Programming Process
Analyzing a Problem Statement
Input Process Output
Developing a solution in plan English language or flow chart
Algorithm
Converting the solution from human language to specific high level
programming language
Coding
Testing
Documentation
When you are presented with a programming challenge, the first step that you need to take is to
analyze by asking three main questions.
• What are the required outputs? You should start by thinking about the outputs.
Understanding the required output will help to find what data you need and what is the
necessary process to solve the problem.
• The next step is answering this questions. What are the required data or in other words
what are the needed inputs to solve this problem?
• The next question what are the steps required to solve this challenge? If you can not write
the steps needed to solve a problem in plain human language, you will not be able to develop
a programming code to solve the same problem. The computer program will only automate
the solution that you designed.
Once you have the solutions in plain English, you need to start translating to a high-level
computer language using specific keywords/syntax.
The next step is to perform various tests to ensure the programming is producing the correct
solution. The simplest way to test your code is by entering different inputs and compare the
results with expected outputs. You have to make sure you cover all different possible scenarios.
The last step is to document your solution to help other developers to improve it. You also
required to write comments inside your code to improve its readability. Depending on the scale
of your program, You may need to create a user manual to guide users on how to use your
program.
3
4. Example 1:
Develop a computer program that calculates and displays the VAT, the total cost including
VAT withoriginal pricepurchased by a customer.
Original price: 1000
VAT: 50
Total: 1050
We need to know the original price. Let us call it original, which represent the total price of
all items.
The rate of VAT. In UAE VAT rate is 5%.
What are the steps required to solve this problem?
Here, you write the solution using plan human language. We will use English, but you can use
any language.
Before writing the steps, let us assume that you purchased items with original cost 1000 and
the VAT rate is 5%. What is the total cost including VAT? If you can calculate this, then you can
write the steps/solution.
The calculation is as follows:
VAT = original * 5/100 VAT = 1000 * 5/100 = 50
Total = original + VAT Total = 1000 + 50 = 1050
The step/solution to solve this problem are:
• Give/assign a value to the original price. We will give it the name original
• Calculate VAT as: VAT = original * 5/100
• Calculate Total as: Total = original + VAT
• Print original
• Print VAT
• Print Total
1. Problem statement:
We need to answer this question.
We need to detemine the output which is usally display on the screen, store in a file, print on paper. In the
given problem the output is to display the original amount, VAT amount, and totalcost. The output will look
like this:
2. Analysis:
2.2 What are the inputs required for this solution?
3. Algorithm:
4
2.1 What outputs are produced by the program?
5. 4. Coding:
In this step, we need to translate the solution from human language to high-level computer
language. We will use Java. Here you find the solution in human language to the left in Java
code to the right:
3. Give/assign a value to the original price: original
4. Calculate VAT as: VAT = original * 5/100
5. Calculate Total as: Total = original + VAT
6. Print original
7. Print VAT
8. Print Total
For now, focus on lines 3 to 8. We will explain the rest later.
The line ” Give/assign a value to the original price: original”, which is written in the human
language is translated to line 3 in java:
The variable “original” is used to store the price of the purchased items. Variables are the
same as what you use in Math (,x, y, z, etc.). They are used to represent a value. Nothing is
new here. The variable name cannot start by a number or special character. But, what is
the word float?
In the most high-level programming language such as C/C++, C+, and Java, you need to
specify/declare the data type of every variable. For now, look at float as any number that
has a decimal point. The best data type for the price is a float. The data type float allows 7
decimal digits. So you can store a number such as 1.3333333. There is another similar data
type called double, which can store up to 16 decimal digits. With the price of items, you
need only two decimal digits. Therefore, the float is enough. We will discuss data types in
details in the next unit. For now, you need to know that the variable original is used to store
the original price as a float.
It is important that each line in Java end by a semicolon except the lines that start by if, else,
for, while, or a declaration of a function. We will discuss them later in this course.
Line 4: calculates VAT as follows:
Again, VAT is declared as float. To calculated VAT value, you need to multiple the original
price with 5/100.
Line 5: calculates the total by multiplying original with VAT.
Line 6 to 8 display the results.
To display data on the computer screen/console you need to use the line:
Text to be
displayed on
the screen.
+
sign
Variable
to be
displayed 5
6. It is important to note that Java is a case-sensitive language. That means Total with T
Uppercase is entirely different from total with t lowercase.
What is about the rest of the code (line 1 to 2 and 9 to 10)?
Start of
the class
End of
the class
Start of the
function
End of the
function
Every program in Java should start by the word class. Later in your study program, you will
study object-oriented programming, where classes are discussed in details. At this stage,
you can look at the class as a container that includes your codes. Of course, you can have
multiple classes in your program, and you can build a relationship between two or more
classes. For now, your code should start by the word class in lower case, followed by a
space, then a name. In this example, we are using the class name Main with M uppercase.
If you change it to be with m lowercase, then you need to change the file name to main.java
with m lower case. The rule is that class name and file name must match each other.
After the class name you need to use an open brace type of bracket. {
The file should end by closed brace. } See line 10.
Line 2: The main class of your Java program must have a function. A function is a group
of one and more line of code. All lines of code in a function can be executed or called
using one name. Your main Java class must have this main function:
6
7. The main function:
The main function in Java should meet the following conditions
1. Start by the word public. A public function can be called from everywhere in
your code.
2. The second keyword is static. A static function can be called without the
need to create a copy (object) of your class.
3. The third keyword is void. It means this function will not return a value. We
will discuss this in more details when we get to functions.
4. The name of the function must be main with m lowercase.
5. The name of the function should be followed by (String[] args)
6. You may replace args with another variable if needed.
7. The line must end with an opened brace { type of bracket.
8. One blank space is required between the keywords.
Space
Line 9 closes the main function.
Start of
the class
End of
the class
Start of the
function
End of the
function
7
8. Using REPL.it
You may be asking this question. What software do I need to install on my computer to
start programming in Java?
The simplest method to programming in Java without the need to install Java
Development Kits (JDKs) on your computer is to use REPL.it cloud solution. You need to
register at
https://repl.it/classroom/invite/YO4IQaw
Please make sure that you use a correct email address. You will receive an email with a
link to confirm your registration. After you confirm your registration, you need to revisit
this address, again https://repl.it/classroom/invite/YO4IQaw
You will be asked to update your profile by entering your first, last email, and university.
Then, you will get a window that looks like this.
1. Here you will
find future
course
assignments.
2. By click here
you can start
writing a
program
Click on “My repls” menu to create a new program. As this is may be your first time
building a program, you have an empty window. Click on
Type Java in the provided text box, then select Java from the list.
Click on this line.
8
9. Components of REPL Development Environment
REPL.it is a cloud based development environment. You can develop and test your
programs online. The following image illustrates the key components of REPL.
Files window. All
your files will be
listed here.
The codes of the
opened file will
appear here.
The inputs and
outputs of your code
will appear here
Click run
to run the
code
To add a
new file
To
rename
the file
To view previous
versions of your
code
We may refer to this
windows as
“terminal”
Completing your code:
Type the following code inside the main function.
To avoid having many errors in your code, please make sure you follow these rules:
• Most lines should end by a semicolon ;. The compiler will tell you which line is
missing a semicolon.
• Make sure you use the same name of the variable with the same case in all your
code. In Java, VAT is different from Vat or vat.
• Make sure you have no space in the variable name. For example original price is
not allowed, but original_price or originalprice are allowed.
• Make sure to close all open brackets. The number of opened brackets should
match number of closed brackets.
• The key word float is in lowercase
9
10. Completing your code:
You need first to run your code to ensure it contains no errors. Click the icon
If there are no errors, your program will produce these results in the terminal window.
The following image illustrates where these results are coming from.
To change the original price and recalculate the VAT and total, you need only to change the
value in line 3. for example, you make it, float original = 2000;
Debugging
In programming debugging is a term that used to fix errors in a computer code.
Let us make some syntax errors (typo errors) and see how Java compiler will
present these errors to us. We will start by deleting the semicolon in line 3.
The error
saying ; is
expected.
10
11. We will fix the ; and create another error in line 5.
Instead of VAT we will use vat. Remember Java is case sensitive. VAT is different from
the vat. In the previous line (4) we declared VAT and not vat. While compiling the line 5
the compiler will not find a value or data type for the variable vat and will produce this
error.
The error is saying “error: cannot find symbol.” When you get such error, check the
variable name and make sure you are calling it using the correct case that you used to
declare it.
We can fix this in two way:
• The first option is to change the vat in line 5 to VAT. This will match how you declared
in line 4.
• The second option is to change VAT in line 4 to vat. In this case, you also need to change line 7
to have vat instead of the VAT.
The first option is preferred as it does not require changing other lines of code.
Let us now delete one bracket. In line 8, we will change this line
to We simply remove the closing bracket ) which is located before
the semicolon. Here is the error that will be generated.
You can fix this simple error by adding the required bracket and run the code.
11
12. The error is very clear. I think you have noticed that Java compiler produces clear error
messages, which easy to find and fix mistakes. However, the following error will
generate a misleading message.
Assume we removed + from line 8.
The generated error did not mention the + sign. But, it refers to a missing bracket.
When you are dealing with System.out.println, then you may check the missing + sign.
Please note that Java uses + in the println function. If you have experience with
programming in other languages, you may notice that some use comma or period.
Debugging logical errors:
All the above errors are syntax errors. There are resulted from making typo mistakes
while typing the code. Examples, wrong spelling of variable, function, or data types.
Also, possible missing a semicolon, bracket, or other signs.
The Java compiler will find these errors.
However, if you make a logical error while the syntax is correct, the compiler will not
be able to find such error. A simple example of a logical error is making a wrong
calculation. Other errors are related to using wrong conditions in your if statement.
We will discuss if statement later in the course.
Let us make a wrong VAT calculation in line 4.
We will write it without dividing by 100 as
Running this code will generate no errors, but the results will be wrong.
The VAT value is
more than the
original price!
12
13. Debugging the logical errors require using a test data with correct results. The
accurate results are usually obtained from a manual calculation. You need to run your
program, enter the data, and check the result against the expected correct result. You
test data should cover all possible scenarios.
Documentation
Now you have tested your program and found it working well. It is time to document
your code.
Comments:
The first type of documentation should be done while you are writing the code. We
did not explain from the beginning to avoid distracting you from the primary process.
This type of documentation is called comments. Comments are added to the actual
code to improve its readability. So, when someone else or yourself read the code, it
will be easy to understand its logic and the reason why it is written this way.
Java compiler ignores the comment lines when checking for errors.
There are two types of comments.
• Single line comment. Single line comments start by //. It allows the programmer
to write a short explanation of one line of code
• A Multi line (paragraph type of) comment. It begins with/* and ends by */. This type of
comments is usually added at the beginning of the code or functions.
Let us add single and multiple line of comments to our code.
Line 1 to 6: Multiple lines comments to explain the problem that this program is
attempting to solve.
Line 9: A single comment clarifying that the original variable store the total of all
purchase items without VAT
Line 11: A single line comment to explain the purpose of VAT variable
Line 13: A single line comment to inform the reader that the reaming lines will
display the results.
Start of
multiple lines
comments
End of
multiple lines
comments
13
14. Other Documentations
For large programs, you required to produce documents that covers, analysis, design,
coding, testing, limitations of the solution, suggested future development, and user
manual that explains how to use the program.
Accepting user inputs
One limitation of our current program is that it always calculates VAT for an
original fixed price. Every time when we need to change the value of the variable
original we need to change the code. This is not an ideal solution. We need to
be able to change the value of the original variable during the runtime.
To this, we need to use an addition Java package, which is java.util.Scanner. A package
is a collection of code to perform a specific task. The Scanner package allows the user
to enter data through the keyboard. In Java to use an additional package, you need
to use the keyword imports at the beginning of your code. Now, line 1 will be:
When you import any package, you need to create an object, which will perform the
required task for you. The object becomes the representative of the package. Line 11
will create the object and give it the name scan.
This line will be used in almost every program that you are going to write from now
and on.
The next thing that we need to do is to tell the user that he/she needs to enter a value
for the original price. In this case, we will use System.out.println to display the
message. See line 13.
Now, we need to change the line float original = 1000; to
When the above line is executed, the user will be able to enter a value for the original
price. The rest of the code will stay with no changes.
14
15. When you run this code, you will be prompted to enter the total of the purchased item
then hit enter as follows:
The results will be:
Lab activities
Exercises 1:
Develop a Java program that prompt the user to enter three numbers,
calculates and display the total and the average of the three numbers.
The Outputs:
Give an example of what out is required.
The Inputs:
What are required inputs and their data types?
The Process:
Write a step by step solution using plan English language
15
16. Coding:
Convert your solution into Java programming code using REPL.it
Debugging:
What errors did you find in your code and how did you solve them?
Testing:
What data did you use to test your code and explain the results?
16
17. Lab activities
Exercises 2:
Develop a Java program that prompt the user to enter the price of a car and the
car insurance rate, then calculates and display the cost of insurance.
The Outputs:
Give an example of what out is required.
The Inputs:
What are required inputs and their data types?
The Process:
Write a step by step solution using plan English language
17
18. Coding:
Convert your solution into Java programming code using REPL.it
Debugging:
What errors did you find in your code and how did you solve them?
Testing:
What data did you use to test your code and explain the results?
18
19. Lab activities
Exercises 3:
Develop a Java program that allows the user to enter the name of the
students and his/her marks for three assessments, then calculate and display
the total scores in the course.
The Outputs:
Give an example of what out is required.
The Inputs:
What are required inputs and their data types?
The Process:
Write a step by step solution using plan English language
19
20. Coding:
Convert your solution into Java programming code using REPL.it. To allow entering the
student name, you need to use the line
Debugging:
What errors did you find in your code and how did you solve them?
Testing:
What data did you use to test your code and explain the results?
20