1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
masha68 [24]
3 years ago
6

Create a class Book with two private int fields, numPages and currentPage. Supply a constructor that takes one parameter and set

s numPages to that value and currentPage to 1. Provide accessor methods for both fields. Also provide a method nextPage that increments currentPage by 1, but only if currentPage is less than numPages.
Computers and Technology
1 answer:
Law Incorporation [45]3 years ago
4 0

Answer:

The code is in the explanation.

Explanation:

/*Creating the class*/

public class Book{

      /*Here we put the attributes of the class;

      In our case, they are the two private ints*/

      private int numPages;

      private int currentPage;

    /*Here is the constructor.

    The constructor always has the same name as the class

     In (), are the parameters.*/

     public Book(int numberOfPages){

                numPages = numberOfPages; /*sets numPages to the value

                                                                    of the parameter*/      

               currentPage = 1; /*sets currentPage to 1*/    

}

   /*An acessor method is a method with which we can get the value of a      variable*/

    /*Acessor method for numPages*/

   /*numPages is an int, so the acessor method returns an int*/

    public int getnumPages(){

            return numPages;

    }

    /*Acessor method for currentPage*/

    public int getcurrentPage(){

           return currentPage;    

     }

     /*Method next page*/

     /*This method does not return anything, so it is a void method*/

     public void nextPage(){

     /*Verify that currentPage is less than numPages*/

     if (currentPage < numPages){

             currentPage = currentPage + 1;

     }

     }

}

You might be interested in
Question 3
prohojiy [21]

The Answer Should Be:

<u>The first thing for you to do when you arrive at an intersection is to stop at the traffic light. Your going to want to listen to the instructions or signals of the traffic Police.</u>

I Hope This Helps? :)

8 0
3 years ago
Find what the secret message is. Get Brainliest if you are fast and correct.
Firdavs [7]

Answer:

What does your digital footprint say about you?

Explanation:

Just follow the path from the end to the start, that's how I always get mazes.

8 0
3 years ago
Read 2 more answers
Which programming language was released first? FORTRAN BASIC Perl Pascal<br><br>ANSWER: FORTRAN (A)
julsineya [31]

Answer:

FORTRAN

Explanation:

  • The first programming language was FORTRAN .
  • It was released on 1957
  • About 65 years ago , when programming languages are at infant stage
8 0
2 years ago
Read 2 more answers
A coffee shop is considering accepting orders and payments through their phone app and have decided to use public key encryption
Charra [1.4K]

Answer: Yes

Explanation:

Public key encryption is the encryption technique that is used for private keys and public keys for securing the system.Public key is used for encryption and private key is for decryption.Public keys can only open content of the system

  • According to the question, public key encryption is secure for coffee shop customer payment process as they are stored on digital certificates in long form for verifying digital signature and encrypting information.Its computation is difficult to crack through power computer access.  
  • Other options is incorrect as encryption is not a problem for payment procedures. Thus, the correct option is yes ,public key encryption is secure method for coffee shop customers .
8 0
3 years ago
Which organization or agency would assist the fire department with incident scene security, crowd control, and explosives dispos
Sav [38]

The organization or agency would assist the fire department with incident scene security, crowd control, and explosives disposal is law <u>enforcement</u>.

<h3>What is Law enforcement?</h3>

Law enforcement is said to be activity of a given members of government and they are said to often act in an organized manner to enforce law by knowing , deterring people who violate the rules and regulations that are governing that society.

hence, The organization or agency would assist the fire department with incident scene security, crowd control, and explosives disposal is law <u>enforcement</u>.

Learn more about law enforcement from

brainly.com/question/21082629

#SPJ1

8 0
2 years ago
Other questions:
  • How was windows 3 installed on a pc?
    11·1 answer
  • What sends massive amounts of email to a specific person or system that can cause that user's server to stop functioning? mail b
    6·1 answer
  • Which federal agency enforces safety and health legislation and requires employers to be sure that adequate first-aid supplies a
    5·1 answer
  • Hi, please help me complete my Database Development 2 hw by completing what should been done from the document and show the code
    11·1 answer
  • Here is a list of storage devices:
    5·1 answer
  • Teniendo en cuenta la realidad mundial acerca de la pandemia, ¿cómo crees que impacta
    9·1 answer
  • Why is it easier to spot a syntax error than a logical error?​
    10·2 answers
  • Working with text in presentation programs is very ____ using text in other applications.
    10·1 answer
  • In your own opinion how comes the surface grinding machine is called a highly accurate machine tool?​
    11·1 answer
  • A manager suspects that one of his team members has been fraudulently accessing confidential and sensitive information and breac
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!