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
What are the first steps that you should take if you're unable to get onto the internet
zhenek [66]

Answer:

See below

Explanation:

  • Check the physical connections first.
  • Ethernet cable to PC and or router, and power cable / power status.
  • Next try to reboot the router and check lights status.
  • If everything is fine on your end then contact your internet provider to further troubleshoot on their end.
4 0
4 years ago
Read 2 more answers
How have computers changed overtime
sattari [20]
So in the beginning, a regular computer took up the space of an entire room it was literally that big in size. now and days computers are this small object that you can carry around with you in your bag.
4 0
3 years ago
Read 2 more answers
48
Irina-Kira [14]

The statement that best explains the benefit that higher page placement provides those who use search engine optimization well is option A. People are more likely to click the first results than those further down the page.

<h3>What advantages do search engine results pages offer?</h3>

Search engine results pages (SERPs) typically feature paid search and pay-per-click (PPC) advertisements in addition to organic search results. Since consumers are more inclined to click on results at the top of the page, ranking position on a SERP can be very competitive thanks to search engine optimization (SEO).

Therefore, Search engine optimization, or SEO, is the act of enhancing your website to raise its natural prominence for particular search queries. Through onsite adjustments, SEO seeks to increase both the quality and volume of traffic to your website.

Learn more about search engine optimization from

brainly.com/question/14097391
#SPJ1

3 0
1 year ago
Supports traditional transactional processing for day-to-day front-office operations or systems that deal directly with the cust
Jet001 [13]

Answer:

Operational CRM.

Explanation:

Operational CRM can be described as most of the programs that allow a company to taking care of the desires of the consumers. The structure links and maintains the selling, marketing, and customer support activities of a corporation, thus providing a structure that requires customer service.

So, the following answer is correct according to the statement.

7 0
4 years ago
how to answer the questions on brainly? I've typed my answer in the box but there's no submit button or whatever, and the only t
Zigmanuir [339]

Answer:

push the add your answer button

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • In the simulation, player 2 will always play according to the same strategy. The number of coins player 2 spends is based on wha
    6·1 answer
  • Your project must satisfy the following requirements:
    7·1 answer
  • Supply is a powerful force in a free market.
    9·2 answers
  • 50 POINTS PLEASE HELP MEEEEEEEEE!!!!!!
    7·2 answers
  • The first thing you must consider in any type of communication is ______.
    9·2 answers
  • An attacker compromises the Washington Post's web server and proceeds to modify the homepage slightly by inserting a 1x1 pixel i
    12·1 answer
  • Online transaction processing (OLTP) and online analytical processing (OLAP) are similar MIS strategies used to help with busine
    9·1 answer
  • Define cyberstalking ?​
    6·2 answers
  • Which of the following statements is TRUE of business intelligence (BI) systems? Business intelligence systems are primarily use
    7·1 answer
  • Calculator is an example of
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!