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
valkas [14]
3 years ago
12

// This program accepts data about 100 books and// determines a price for each.// The price is 10 cents per page for the// first

200 pages, then 8 cents// per page after that.// After pricing, all the data is displayed.// Create a Book class and modify the program to use// an array of Book objects instead of individual// data items.startDeclarationsnum SIZE = 100num substring titles[SIZE]num pages[SIZE]num prices[SIZE]num MIN_PAGES = 200num HIGH_PRICE = 0.10num LOW_PRICE = 0.08sub = 0while sub < SIZEoutput "Enter title "input title[sub]output "Enter pages "input pages[sub]if pages[sub] <= MIN_PAGES thenprice[sub] = pages[sub] * HIGH_PRICEelseprice[sub] = MIN_PAGES * HIGH_PRICE +(pages[sub] MIN_PAGES) * LOW_PRICEendifendwhiledisplayBooks(titles, pages, prices, SIZE)stopvoid displayBooks(string[] titles, num[] pages, num[] prices, num SIZE)Declarationsint xx = 0while x < SIZEoutput "Title: ", titles[x]output "Pages: ", pages[x]output "Price: ", prices[x]x = x + 1endwhilereturn
Engineering
1 answer:
dybincka [34]3 years ago
3 0

Answer:

Check the explanation

Explanation:

Begin class Books:

   string title

   num pages

   num price

   num MIN_PAGES=200

   num HIGH_PRICE=0.10

   num LOW_PRICE=0.8      Books(title, page)

       title= title

        pages=page

        price=0.0

   end of constructor

string getTitle()

       return title

   end of getTitle

   num getPages()

       return pages

   end of getPages

 

   num getPrice()

       if(pages<=MIN_PAGES)

            price=getPages()*HIGH_PRICE

        else

            price=MIN_PAGES*HIGH_PRICE+(pages-MIN_PAGES)*LOW_PRICE

        end of if

        return price

   end of getPrice

  string toString()

       string s=""

        s+="Title: "+getTitle()

        s+="\nPages: "+getPages()

        s+="\nPrice: "+getPrice()

        return s

   end of toString

end Books class

start

class BooksImplementation

    main()

     Declarations  

        Books books[100]

        num size

        string title

        num pages

        output "Enter the size of the Books array: "

        input size

 for i=0; i<size; i++        

            output "Enter Book title: "

            input title

            output "Enter number of pages in the book: "

            input pages

            books[i]=new Books(title, pages)

        end of for        

        output "The details of book and it prices are: ")

        for int i=0; i<size ; i++        

            output "Book "+(i+1)+": "

            output books[i].toString()

       end of for

   end of main

end of class

stop

You might be interested in
1. Fatigue equations are based solely on theoretical assumptions. Experimental data is only used to verify the theory. a. True.b
Rainbow [258]

Answer:

1.  b. False

2. b. False

3.  b. False

4.  b. False

5. a. True

6. a. True

7.  b. False

8.  b. False

9. a. True

Explanation:

1. The fatigue properties of a material  are determined by series of test.

2. For most steels there is a level of fatigue limit below which a component will survive an infinite number of cycles, for aluminum and titanium a fatigue limit can not be defined, as failure will eventually occur after enough experienced cycles.

3. Although there is a cyclic stress, there are also stresses complex circumstances involving tensile to compresive and constant stress, where the solution is given into the mean stress and the stress amplitude or stress range, which is double the stress amplitude.

4. Low‐cycle fatigue is defined as few thousand cycles and high cycle fatigue is around more than 10,000 cycles.

5. The number of cycles for failure on brittle materials are less and determined compared with the ductile materials.

6.  The bending fatigue could be handled with specific load requirements  for uniform bending or axial fatigue of the same section size where the material near the surface is subjected to the  maximum stress, as in torsional fatigue, which can be performed on  axial-type specially designed machines also, using the proper fixtures if  the maximum twist required is small, in which linear motion is changed to rotational motion.

7.  A SN-Curve for a given material, is a plot displayed on logarithmic scales of the magnitude of an alternating stress in relation to the number of cycles to failure

8. The strain life method measures the strain resistance of local stresses and strains around stress concentration that controls the fatigue life of the material. It is more accurate than determining fatigue performance as the stress-life method is for long life millions of cycles in elastic stresses, but an it gets an effective stress concentration in fatigue loading.

9. Linear Elastic Fracture Mechanics (LEFM) states that the material is isotropic and linear elastic so, when the stresses near the crack surpasses the material fracture toughness, the crack grows.

7 0
3 years ago
When two or more simple machines are combined they form
Volgvan
Compound machine is the answer
8 0
3 years ago
The dot plot shows the number of cupcakes bought by each person who came to a bake sale.
Maslowich

The true statement about the dot plot is 1 has 4 and 0 dots.

Explanation:

  • after creating a Bar chart 4 is the right answer.
  • The highest among st all the other plots is 1 but 4 shows 3.
  • Taking an average from all the data points 3 comes to the right answer.
  • Median the central Mid-point is 3.
  • Mode also comes to 3.
  • It is skewed on the right due to the 1st one.
  • Skewed shows the data point either increasing or in decreasing.
  • There a to Bi- histograms which has two ups and downs.
  • The true statement has to be as Mean=Median=Mode is 3.

6 0
3 years ago
The acceleration of a particle is given by a = 2t − 10, where a is in meters per second squared and t is in seconds. Determine t
tensa zangetsu [6.8K]

Answer

given,

a = 2 t - 10

velocity function

we know,

\dfrac{dv}{dt}=a

\dfrac{dv}{dt}=(2t-10)

integrating both side

\int dv =\int (2t -10) dt

 v = t² - 10 t + C

at t = 0   v = 3

so, 3 = 0 - 0 + C

     C = 3

Velocity function is equal to v = t² - 10 t + 3

Again we know,

\dfrac{dx}{dt}=v

\dfrac{dx}{dt}=(t^2-10t + 3)

integrating both side

\int dx =\int (t^2-10t + 3)dt

x = \dfrac{t^3}{3}- 10\dfrac{t^2}{2} + 3 t + C

now, at t= 0 s = -4

-4 = \dfrac{0^3}{3}- 10\dfrac{0^2}{2} + 0 + C

C = -4

So,

x = \dfrac{t^3}{3}- 10\dfrac{t^2}{2} + 3 t-4

Position function is equal to x = \dfrac{t^3}{3}- 10\dfrac{t^2}{2} + 3 t-4

8 0
3 years ago
Same rule: If both players spend the same number of coins, player 2 gains 1 coin. Off-by-one rule: If the players do not spend t
Galina-37 [17]

Answer:

Check the explanation

Explanation:

1 -

public int getPlayer2Move(int round)

{

  int result = 0;

 

  //If round is divided by 3

  if(round%3 == 0) {

      result= 3;

  }

  //if round is not divided by 3 and is divided by 2

  else if(round%3 != 0 && round%2 == 0) {

      result = 2;

  }

  //if round is not divided by 3 or 2

  else {

      result = 1;

  }

 

  return result;

}

2-

public void playGame()

{

 

  //Initializing player 1 coins

  int player1Coins = startingCoins;

 

  //Initializing player 2 coins

  int player2Coins = startingCoins;

 

 

  for ( int round = 1 ; round <= maxRounds ; round++) {

     

      //if the player 1 or player 2 coins are less than 3

      if(player1Coins < 3 || player2Coins < 3) {

          break;

      }

     

      //The number of coins player 1 spends

      int player1Spends = getPlayer1Move();

     

      //The number of coins player 2 spends

      int player2Spends = getPlayer2Move(round);

     

      //Remaining coins of player 1

      player1Coins -= player1Spends;

     

      //Remaining coins of player 2

      player2Coins -= player2Spends;

     

      //If player 2 spends the same number of coins as player 2 spends

      if ( player1Spends == player2Spends) {

          player2Coins += 1;

          continue;

      }

     

      //positive difference between the number of coins spent by the two players

      int difference = Math.abs(player1Spends - player2Spends) ;

     

      //if difference is 1

      if( difference == 1) {

          player2Coins += 1;

          continue;

      }

     

      //If difference is 2

      if(difference == 2) {

          player1Coins += 2;

          continue;

      }

     

     

  }

 

  // At the end of the game

  //If player 1 coins is equal to player two coins

  if(player1Coins == player2Coins) {

      System.out.println("tie game");

  }

  //If player 1 coins are greater than player 2 coins

  else if(player1Coins > player2Coins) {

      System.out.println("player 1 wins");

  }

  //If player 2 coins is grater than player 2 coins

  else if(player1Coins < player2Coins) {

      System.out.println("player 2 wins");

  }

}

3 0
3 years ago
Other questions:
  • The net potential energy EN between two adjacent ions, is sometimes represented by the expression
    13·1 answer
  • A composite wall consists of 20 mm thick steel plate backed by insulation brick (k = 0.39 W/mK) of 50 cm thickness and overlaid
    6·1 answer
  • A lake with a surface area of 525 acres was monitored over a period of time. During onemonth period the inflow was 30 cfs (ie. f
    5·1 answer
  • The impeller shaft of a fluid agitator transmits 28 kW at 440 rpm. If the allowable shear stress in the impeller shaft must be l
    6·1 answer
  • An equal-tangent sag vertical curve (with a negative initial and a positive final grade) is designed for 55 mi/h. The PVI is at
    5·1 answer
  • Water flowing through both a small pipe and a large pipe can fill a water tank in 4 hours. Water flowing through the small pipe
    5·1 answer
  • What are the mechanical properties of a geotextile that are of most importance when using it as a separator in an unpaved road s
    12·1 answer
  • Select the correct answer.
    12·1 answer
  • Which traits are common in all four career pathways of the Information Technology field? Check all that apply.
    7·1 answer
  • The side area of the door shell that is concealed when the door is closed is called the:
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!