a.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the int variable and assign the value
Integer i = new Integer(“23”);
//Print the required data fields
System.out...
b.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the int variable and assign the value
Integer i = new Integer(23);
//Print the required data fields
System.out...
c.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the int variable and assign the value
Integer i = new Integer.valueOf(“23”);
//Print the required data fields
System.out...
d.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the int variable and assign the value
Integer i = new Integer.parseInt(“23”,8);
//Print the required data fields
System.out...
e.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the double variable and assign the value
Double d = new Double();
//Print the required data fields
System.out...
f.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the double variable and assign the value
Double d = new Double.valueOf(“23.45”);
//Print the required data fields
System.out...
g.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the int variable and assign the value
int i = (Integer.valueOf(“23”)).intValue();
//Print the required data fields
System.out...
h.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the double variable and assign the value
Double d = (Double.valueOf(“23.4”);
//Print the required data fields
System.out...
i.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
//Declare the int variable and assign the value
int i = (Double.valueOf(“23”)).intValue();
//Print the required data fields
System.out...
j.
Explanation of Solution
//Class definition
public class test {
// Define main function
public static void main(String[] args) {
/*Declare the double variable and assign the
Value*/
String s = (Double.valueOf(“23.4”).toString();
//Print the required data fields
System...
Want to see the full answer?
Check out a sample textbook solutionChapter 10 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
- This is what I have so far 2. Too few parameters #include <stdio.h> Void simple(); Int main() { Int n; simple(1,2,3,4,5,6,7,8,9,10,11,12); Return0; } Void simple(int n){ printf(“%d”,n); printf(%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d) } What gets printed? The values 1 and the garbage values get printed. Where do the values come from? The values are some random values generated for the storage part failures like this where we are not allocating values but using them. Why? 1 is printed as per the statement. Garbage values are generated because of not having any argument passed to them to locate a specific location. 3. Too small arrayarrow_forwardcan you modify it please so it can print the first name initial, followed by middle name initial, followed by last name initial: [J, R, B].thank youarrow_forwardWrite the output of the following code:mister_pet = Pet("Master", "Dog")mister_dog = Dog("Mister", True)mister_cat = Cat("Tom",False)mister_cat_2 = Cat("Bully", True)print(mister_dog.getName())print(mister_pet.getName())print(mister_cat.getName())print(mister_cat_2.hatesDogs())print(mister_cat.hatesDogs())arrow_forward
- Please Help me asap Please USE PYTHON Implement the design of the Pasta class so that the following output is produced:print("Pasta Plate Count:", Pasta.pasta_plate_count)print("=======================")s1 = Pasta("Chicken")s1.set_ingredients("Farfalle",250, 11, 40, 10)s1.display_all_info()print("------------------------------------")s2 = Pasta("Beef")s2.set_ingredients("Pipe Rigate",150, 10.5, 10, 10)s2.display_all_info()print("------------------------------------")s3 = Pasta("Mushrooms")s3.set_ingredients("Spaghetti",500, 50, 20, 10)s3.display_all_info()print("=======================")print("Pasta Plate Count:", Pasta.pasta_plate_count)Output:Pasta Plate Count: 0=======================Pasta Type: ChickenShape: FarfalleCal: 250 gFat: 11 gProtein: 40 gCarbohydrate: 10 g------------------------------------Pasta Type: BeefShape: Pipe RigateCal: 150 gFat: 10.5 gProtein: 10 gCarbohydrate: 10 g------------------------------------Pasta Type: MushroomsShape: SpaghettiCal: 500 gFat: 50…arrow_forwardThe following program invokes p() three times. What is the output from the last call of p()? #include <iostream> using namespace std; int j = 40; void p() { int i = 5; static int j = 5; i++; j++; cout << "i is " << i << " j is " << j << endl;arrow_forwardWhat will be the value of x[8] after the following code is executed? final int NUM = 10;int[] x = new int[NUM];int y = 1;for (int i = 0; i < NUM; i++){x[i] = y;y++;} 1 9 7 5arrow_forward
- Help me asap Please Use PYTHON Implement the design of the Pasta class so that the following output is produced:print("Pasta Plate Count:", Pasta.pasta_plate_count)print("=======================")s1 = Pasta("Chicken")s1.set_ingredients("Farfalle",250, 11, 40, 10)s1.display_all_info()print("------------------------------------")s2 = Pasta("Beef")s2.set_ingredients("Pipe Rigate",150, 10.5, 10, 10)s2.display_all_info()print("------------------------------------")s3 = Pasta("Mushrooms")s3.set_ingredients("Spaghetti",500, 50, 20, 10)s3.display_all_info()print("=======================")print("Pasta Plate Count:", Pasta.pasta_plate_count)Output:Pasta Plate Count: 0=======================Pasta Type: ChickenShape: FarfalleCal: 250 gFat: 11 gProtein: 40 gCarbohydrate: 10 g------------------------------------Pasta Type: BeefShape: Pipe RigateCal: 150 gFat: 10.5 gProtein: 10 gCarbohydrate: 10 g------------------------------------Pasta Type: MushroomsShape: SpaghettiCal: 500 gFat: 50 gProtein: 20…arrow_forwardI'm confused on what I need to do. What do I do? My code: #include <iostream> #include <cassert> using namespace std; class IntArr { public: IntArr(); IntArr(int c); int& operator[](int index); constint& operator[](int index) const; IntArr(const IntArr &a); IntArr& operator=(const IntArr &a); ~IntArr(); int getSize() const; int getCapacity() const; void push_back(int n); void pop_back(); private: void grow(); int capacity; int size; int *array; }; IntArr::IntArr(){ capacity = 5; } IntArr::IntArr(int c): capacity(c){ size = 0; assert(c>0); IntArr a{c}; } int& IntArr::operator[](int index){ if(index > 0 && index <= size-1) return a[index]; } const int& IntArr::operator[](int index)const{ } IntArr::IntArr(const IntArr& a){ } IntArr& IntArr::operator=(const IntArr& a){ } IntArr::~IntArr(){ } int IntArr::getSize() const{ } int IntArr::getCapacity() const{ } void IntArr::grow(){ } void…arrow_forwardIn python -Once upon a time in the Land of Apples, John had three apples, Mary had five apples, and Adam had six apples. -Create the variables: juan, maria, and adan. -Assign values to variables. The value must be equal to the number of apples that each person had. -Once the numbers are stored in the variables, print the variables on one line, and separate each one with a comma. -Then a new variable called totalApples must be created and must be equal to the sum of the previous three variables.arrow_forward
- USE THE PROGRAM CODE BELOW TO CODE 1. COMMAND LINE ARGS CODE IN JAVA 1. Command Line Args Modify problem # 1 from Lab 8 to accept the values for the key as command line arguments. Your program may assume the arguments given at the command line are integers. If there are no arguments, print a message. If there is at least one argument, compute and print the average of the arguments. Note that you will need to use the parseInt method of the Integer class to extract integer values from the strings that are passed in. If any non-integer values are passed in, your program will produce an error, which is unavoidable at this point. Test your program in NetBeans using the data for problem # 1 Lab 8 as command line arguments. import java.util.Scanner;import java.text.NumberFormat; public class Quizzes{ //---------------------------------------------- // Read in the number of questions followed by // the key, then read in each student's answers // and calculate the number…arrow_forwardThis is a debugging question - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Code I was given - // A byte can't hold a value higher than 127 // This program throws an ArithmeticException // if adding two bytes yields a value that is too high public class DebugTwelve2 { public static void main(String[] args) { byte num1 = 120, num2 = 120, result; final byte HIGHBYTE = 127; try { allowed = (byte)(HIGHBYTE - num1); if(num2 > allowed) throw(new Arithmeticexception()); result = (byte)(num1 + num2); System.out.println("Result is + result); } catch(ArithmeticcException error) { System.out.println("Byte can't hold value higher than " + HIGHBYT); } } }arrow_forwardWhat is the output of the following code? int num = 17; //Line 1double gpa = 3.85; //Line 2bool done; //Line 3done = (num == static_cast<int>(2 * gpa + 9.3)); //Line 4cout << "The value of done is: " << done << endl; //Line 5arrow_forward
- 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