What is a methods signature The signature of a method is the name of the method

What is a methods signature the signature of a method

This preview shows page 4 - 10 out of 14 pages.

What is a method's signature? The signature of a method is the name of the method and the data types of its parameters Which of the following statements are true about annotations in java? @Override is a built-in annotation in java
Image of page 4

Subscribe to view the full document.

How to update the value in map? put Which of following statements are true for inheritance in java? you can inherit only from one Only first element can be accessed in Queues False How to add data in java set? Add Print Unique Number Code: import java.util.HashSet; public class TestSet { public static void main( String [] args){ String st = "This is the only comprehensive curriculum in CUNY that addresses " + "the specific needs of the information technology (IT) industry"
Image of page 5
+ " by integrating theory, hands-on experience and industry exposure " + "to applied skills through a required internship degree program component. " + "It provides the student with the flexibility of choice in specialization areas"; char[] charArray = st.toCharArray(); HashSet set = new HashSet(); for ( char c : charArray ){ set.add( c ); } System.out.println( set ); } } Degree Converter Code: package converter; import java.util.HashMap; import java.util.Scanner; public class Kelvin_Degree { public static void main(String[] args) { HashMap<String,Double > DegreeMap = new HashMap<String, Double >();
Image of page 6

Subscribe to view the full document.

Scanner scan = new Scanner(System.in); DegreeMap.put("Celcius", 0.89 ); DegreeMap.put("Kelvin", 0.76 ); System.out.println("This program converts degree to Kelvin and Celcius"); boolean flagCheck = true; int count = 2; while ( flagCheck ){ System.out.println("Enter Kelvin or Celcius to convert to degrees"); String Unit = scan.next(); if ( DegreeMap.containsKey(Unit)){ System.out.println("Enter degree amount to convert"); String degree = scan.next(); double degrees = Double.parseDouble( degree ); double convert = degrees * DegreeMap.get(Unit); System.out.println("The conversion is " + convert); flagCheck = false; }else{ System.out.println( "Wrong unit of degree, use " + " Celsius / Kelvin "); } count = count - 1; if( count <= 0 ){ break; } }
Image of page 7
} } Write a Java Application to calculate NY tax. (NY Tax Rate: 8.875%). If you product cost $10 with tax price will be $10.08875 Code: package tax; import java.util.Scanner; public class CalculateTax { public static void main(String [] args){ Scanner Scan=new Scanner(System.in); System.out.println("Enter price of product"); int price =Scan.nextInt(); System.out.println("Product Price:" + price); double total = price * (8.875 /100) + price; System.out.println("Your total will be : " + total); } } Write a Java Function to add all the even number between 300 to 5000 Code: package add; public class OddEven { public static void main( String [] args){ int range = 0; for(int i = 300; i < 5000; i++){ if(i%2 == 0){ range = range + i; System.out.println(range); } }
Image of page 8

Subscribe to view the full document.

} } White a Java Function to find a unique number. For simplicity: unique number is a number which can not be divided by 5 for instance 11 Code: package unique; import java.util.Scanner; public class Notdivisbleby5 { public static void main(String [] args){ Scanner Scan = new Scanner(System.in); System.out.println("Enter a number : ");
Image of page 9
Image of page 10

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes