sirbucket / java-course Goto Github PK
View Code? Open in Web Editor NEWAn introduction to Java
Home Page: https://lab.github.com/everydeveloper/introduction-to-java
An introduction to Java
Home Page: https://lab.github.com/everydeveloper/introduction-to-java
In this section, you will create a scanner object to take in user input, declare variables that will store information, and print out a friendly message!
You can comment out our 'Hello world' statement by adding // to the start of that line:
// System.out.println("Hello World!");
Type the following code under Step 2. It will create your scanner object, create your string variables that store text information, and double variables that store numeric values. Most of these variables don't have any values yet (except "cost" and "TAX_RATE"). We are just declairing their name and data type.
The Scanner object has pre-built methods we will use to process user input. Notice how we imported it at the top of the file?
Scanner keyboard = new Scanner (System.in);
String firstName; // User's first name
String itemOrder; // Item ordered
String frostingType; // Frosting ordered
String fillingType; // Filling ordered
String toppings; // Toppings ordered
String input; // User input
double cost = 15.00; // Cost of cake and cupcakes
final double TAX_RATE = .08; // Sales tax rate
double tax; // Amount of tax
Add in the following comment and line of code to print friendly messages:
// Introduce shop and prompt user to input first name
System.out.println("Welcome to Java's Cake & Cupcake Shop!");
System.out.println("We make custom cakes with our secret cake batter!");
Before we test this code, remember to re-compile the java file
javac custom_order.java
Then run the file with this command:
java custom_order
If you see our friendly greeting in your terminal, add a comment to this issue.
Java is a popular programming language for several main reasons:
Java is considered an Object Oriented programming language, making it easy to encapsulate data (and methods) in a class. A class is like a blue-print that contains all the properties that will be inherited by the objects created by it. This makes it easy to organize and re-use blocks of code.
Java is also a compiled language, meaning that it needs to be translated into machine readable code before it can run.
This is an interactive course, where you will be prompted to do something to finish each step.
If it takes more than a few seconds for a response, try refreshing your browser.
Add a comment to this issue with the letter that answers this question.
Which of the following is false about Java?
a. Java is an Object Oriented programming language
b. Java is a scripting language, read only in the browser
c. Java files need to be compiled before you can run them
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.