Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
6th Edition
ISBN: 9780134477367
Author: David J. Barnes, Michael Kolling
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1, Problem 30E
In this chapter we have mentioned the data types int and String. Java has more predefined data types. Find out what they are and what they are used for. To do this, you can check Appendix B, or look it up in another Java book or in an online Java language manual. One such manual is at
http://down!oad.oracle.com/javase/tutoria1/java/nutsandbolts/datatypes.html
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Using Jcreator, open, compile, and run java and observe its runtime. Write your observation regarding how encapsulation works for the program and the data it processed. Limit your paper to a single paragraph with at least 50 words or five (5) sentences.
Source Code:
public class FindAbsoluteValueExample {
public static void main(String args[]) { Integer a = -8; double d = -100; float f = -90;
System.out.println(Math.abs(a)); System.out.println(Math.abs(d)); System.out.println(Math.abs(f)); }}
Using Jcreator, open, compile, and run java and observe its runtime. Write your observation regarding how encapsulation works for the program and the data it processed. Limit your paper to a single paragraph with at least 50 words or five (5) sentences.
Source code:
public class EncapTest { private String name; private String idNum; private int age;
public int getAge() { return age; }
public String getName() { return name; }
public String getIdNum() { return idNum; }
public void setAge( int newAge) { age = newAge; }
public void setName(String newName) { name = newName; }
public void setIdNum( String newId) { idNum = newId; }}
public class RunEncap {
public static void main(String args[]) { EncapTest encap = new EncapTest(); encap.setName("James"); encap.setAge(20); encap.setIdNum("12343ms");
System.out.print("Name : " + encap.getName() + " Age : " + encap.getAge()); }}
Please code in java and explain as simply as possible, restricting code to the basics such as: String, methods, doubles, etc. Thank You
Use these numbers for the text file refered to in the instructions:
2158415291316 6 9735415497168 3 9732419897251 1 2121418896632 9 2324415892321 2 7186415831395 5 8569415899192 3 6093415497365 4 9085384493174 1 201841584642 5
Chapter 1 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Ch. 1 - Prob. 1ECh. 1 - Prob. 2ECh. 1 - Prob. 3ECh. 1 - Prob. 4ECh. 1 - This is a very simple example, and not many colors...Ch. 1 - Prob. 6ECh. 1 - Prob. 7ECh. 1 - Prob. 8ECh. 1 - Prob. 9ECh. 1 - Select Show Terminal from the View menu. This...
Ch. 1 - Select Show Code Pad from the View menu. This...Ch. 1 - Prob. 12ECh. 1 - Prob. 13ECh. 1 - Prob. 14ECh. 1 - Look at the pop-up menu of class Picture again....Ch. 1 - In the source code of class Picture, find the part...Ch. 1 - Add a second sun to the picture. To do this, pay...Ch. 1 - Prob. 18ECh. 1 - Prob. 19ECh. 1 - Prob. 20ECh. 1 - Create an object of class Student. You will notice...Ch. 1 - Prob. 22ECh. 1 - Prob. 23ECh. 1 - Call the numberOfStudents method of that class....Ch. 1 - Look at the signature of the enrollStudent method....Ch. 1 - Prob. 26ECh. 1 - Prob. 27ECh. 1 - Prob. 28ECh. 1 - Prob. 29ECh. 1 - In this chapter we have mentioned the data types...Ch. 1 - What are the types of the following values?...Ch. 1 - Prob. 32ECh. 1 - Write the header for a method named send that has...Ch. 1 - Prob. 34ECh. 1 - Prob. 35ECh. 1 - Prob. 36E
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Can abstract classes also contain abstract properties?
Starting out with Visual C# (4th Edition)
(Data sorted?) Write a program that reads the strings from file SortedStrings.txt and reports whether the strin...
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Either a functions ____ or its ____ must precede all calls to the function.
Starting Out with C++: Early Objects
Describe the purpose of the access key attribute and how it supports accessibility.
Web Development and Design Foundations with HTML5 (8th Edition)
Write a function called i that converts an integer value into a character string. Be certain the function handl...
Programming in C
Thetakes the .class files containing the programs bytecodes and transfers them to primary memory.
Java How To Program (Early Objects)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Considering the dates API in java.time, it is correct to say: 1. It is possible to represent a date as text in any language, as long as you provide the respective information as Locale. B. It is not a Postgres database compatible type. Ç. It is not possible to represent dates before the year 2000. D. The main class in this package is java.util.Date. 5. It follows the standard defined in ISO 8601, so it is ONLY possible to display the data in English.arrow_forwardI need help with a Java program over a University class program shown in the image below: I need to know what I should type down described in the given detail here - Each university object will contain the following information.University NameStreet Address // 1934 Same StreetCity // AnnandaleState // StateZIP // 02497Phone number // 7033345343In-State Tuition per creditup to 12 credits12 – 18 creditsover 18 creditsOut of State Tuition per creditup to 12 credits12 – 18 creditsover 18 creditsLate FeesIncidental feesper credit fee to some maximum feeOptional Health Careper credit scaleup to 12 credits12 – 18 creditsover 18 creditsOn Campus Meal PlanTwo or more plans with different costs eachThe University class will implement getter and setter methods for each field variable. It will also include toString()and equals() methods.The program will store these objects and their information in two separate dynamic data structures, one for thestudents and one for the universities.…arrow_forwardWe have a parking office class for a parking management system. It has dependencies and relations with customer, car, parking lot and parking charge classes. Explain the code by stating implementation decisions, reasons behind those implementation decisions, what you assume was hard or easy to implement, and what helped. public class ParkingOffice {String name;String address;String phone;List<Customer> customers;List<Car> cars;List<ParkingLot> lots;List<ParkingCharge> charges; public ParkingOffice(){customers = new ArrayList<>();cars = new ArrayList<>();lots = new ArrayList<>();charges = new ArrayList<>();}public Customer register() {Customer cust = new Customer(name,address,phone);customers.add(cust);return cust;}public Car register(Customer c,String licence, CarType t) {Car car = new Car(c,licence,t);cars.add(car);return car;}public Customer getCustomer(String name) {for(Customer cust :…arrow_forward
- Where are the test cases for interpreter.java? Write a test case for interpreter.java. For interpreter.java and builtinfunctiondefinitionnode.java, there are missing implementations that needs to be added. Attached are images of the 2 java files. Interpreter.java public class Interpreter { private HashMap<String, InterpreterDataType> globalVariables; private HashMap<String, FunctionDefinitionNode> functions; // Inner class LineManager private class LineManager { private List<String> lines; public LineManager(List<String> inputLines) { this.lines = inputLines; } public boolean splitAndAssign() { // Implementation here... return false; } } public Interpreter(ProgramNode node, String path) { globalVariables = new HashMap<>(); functions = new HashMap<>(); // Other initializations... }} BuiltInFunctionDefinitionNode.java public class…arrow_forwardPlease help with the following im really struggling, most of the work is done I need help with the last part its in JAVA not arrays or this.keword nor Integer.parseInt. try and keep as simple as possible. package school; import java.util.Scanner; public class School { /*** @param args**/public static void main(String[] args) {Scanner sc=new Scanner(System.in);//department 1System.out.println("Department name");String dept1name = sc.nextLine();System.out.println("Department ID");int dept1id = sc.nextInt();sc.nextLine();//department 2System.out.println("Department name");String dept2name = sc.nextLine();System.out.println("Department ID");int dept2id = sc.nextInt();sc.nextLine();//department 3System.out.println("Department name");String dept3name = sc.nextLine();System.out.println("Department ID");int dept3id = sc.nextInt();//Student 1System.out.println("Student ID");int stud1id = sc.nextInt();sc.nextLine();System.out.println("Student name");String stud1name =…arrow_forwardI need to write a java program using these requirements. This is the code I have so far, but Im not sure if it's correct. import java.io.File;import java.io.FileNotFoundException;import java.util.LinkedHashSet;import java.util.LinkedList;import java.util.Scanner; private class Movie { public static void main(String[] args) {// Create LinkedListLinkedList<String> movies = new LinkedList<>();// Create HashSetLinkedHashSet<String> moviesTitle = new LinkedHashSet<>();// read file name from userScanner input = new Scanner(System.in);String fileName = input.next();try {// create an object of ScannerScanner file = new Scanner(new File(fileName));// iterate each line in the filewhile (file.hasNextLine()) {String data = file.nextLine();movies.add(data);String[] dataArray = data.split(",");moviesTitle.add(dataArray[1]);}} catch (FileNotFoundException e) {e.printStackTrace();} // format each linefor (String title : moviesTitle) {// print titleSystem.out.printf("%-44s",…arrow_forward
- I need help with my java compiler program by Generating intermediate code from the AST, such as three-address code or bytecode import java.util.*; public class SimpleCalculator { private final String input;private int position;private boolean hasDivByZero = false;private Map<String, String> symbolTable; public SimpleCalculator(String input) { this.input = input; this.position = 0; this.symbolTable = new HashMap<>();} public static void main(String[] args) { SimpleCalculator calculator = new SimpleCalculator("3 + 5 * (2 - 1)"); int result = calculator.parseExpression(); if (calculator.hasDivByZero) { System.out.println("Error: division by zero"); } else { System.out.println("Result: " + result); }} public int parseExpression() { int value = parseTerm(); while (true) { if (consume('+')) { value += parseTerm(); } else if (consume('-')) { value -= parseTerm(); } else {…arrow_forwardI need help with my java compiler program by Generating intermediate code from the AST, such as three-address code or bytecode import java.util.*; public class SimpleCalculator { private final String input;private int position;private boolean hasDivByZero = false;private Map<String, String> symbolTable; public SimpleCalculator(String input) { this.input = input; this.position = 0; this.symbolTable = new HashMap<>();} public static void main(String[] args) { SimpleCalculator calculator = new SimpleCalculator("3 + 5 * (2 - 1)"); int result = calculator.parseExpression(); if (calculator.hasDivByZero) { System.out.println("Error: division by zero"); } else { System.out.println("Result: " + result); }} public int parseExpression() { int value = parseTerm(); while (true) { if (consume('+')) { value += parseTerm(); } else if (consume('-')) { value -= parseTerm(); } else { break;…arrow_forward***********************Answer question below:****** Write code in Java: - Make sure code is recursive. - Do not change code other than where it says you can. import java.util.*; import java.lang.*; import java.io.*; class DecimalToBinary { public static String decimalToBinary(int value) { //*Code goes here* } } class DriverMain { public static void main(String args[]) { Scanner input = new Scanner(System.in); System.out.print(DecimalToBinary.decimalToBinary(input.nextInt())); } }arrow_forward
- JAVA Program ASAP Please modify this program and take out the main method from the program so it passes the test cases in Hypergrade. I have provided the failed test cases. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.InputMismatchException;import java.util.Scanner;public class FileSorting { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { System.out.println("Please enter the file name or type QUIT to exit:"); String fileName = scanner.nextLine(); if (fileName.equalsIgnoreCase("QUIT")) { break; } try { ArrayList<String> lines = readFile(fileName); if (lines.isEmpty()) { System.out.println("File " + fileName + " is empty."); } else { performSorting(lines);…arrow_forwardIn java How to compare two objects in java? for example :- take one number of long type and other is double and compare them when they are not equal and when they are equalarrow_forwardPlease make a method to convert from binary to decimal and vice versa A “Procedural CLI Calculator” that you will develop using only the procedural constructs of the Java language. You are not allowed to use any object-oriented programming constructs of Java in your implementation except the following: o the Main class, since every Java program needs to be presented as a class, o Scanner class with all its methods for input and output, o Array and String classes with all their methods since most procedural languages provide them among their fundamental constructsarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License