Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the following code to answer the questions ++++++++++++++++++ public class Publication{ protected int pages = 0; protected String title = publication title; } +++++++++++++++++++

Use the following code to answer the questions

++++++++++++++++++

public class Publication{ protected int pages = 0; protected String title = "publication title"; }

+++++++++++++++++++ public class PBook extends Publication{

protected int pages = 100; protected String title = "book title"; public String toString( ){ String s = "title: " + this.title + " pages: "+ this.pages; return s; } }

+++++++++++++++++

public class Pamphlet extends Publication{

protected String company = "company pamphlet"; }

+++++++++++++++++

public class CBook extends ___________ {

protected int pages = 100; protected String title = "Children Book"; public CBook(int pages, String title){ this.pages = pages; this.title = title; } public String toString( ){ String s = "title: " + this.title; return s; } }

Write a piece of java code to solve the following.

Assume that you have an array of integers call arr. ( no need to declare it or fill it up, assume it is already there). This array is of size SIZE.

You will read one number int num from the user.

You will search for num in the array.

  • If you find it,
    • You will print out how many times num is found within the array.
  • If you do not find it,
    • You will find the amount of numbers that are smaller than num.

Please label your output properly. Example "num was found x times" OR "num was not found and there are y numbers smaller than it"

Do not worry if you miss any semi-colons but try to indent so your code is easy to read.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

Timeline for final evaluation

Answered: 1 week ago