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
Fix the code so the program will run correctly for MAXCHEESE values of 0 to 20 (inclusive). Note that the value of MAXCHEESE is
GarryVolchara [31]

Answer:

Code fixed below using Java

Explanation:

<u>Error.java </u>

import java.util.Random;

public class Error {

   public static void main(String[] args) {

       final int MAXCHEESE = 10;

       String[] names = new String[MAXCHEESE];

       double[] prices = new double[MAXCHEESE];

       double[] amounts = new double[MAXCHEESE];

       // Three Special Cheeses

       names[0] = "Humboldt Fog";

       prices[0] = 25.00;

       names[1] = "Red Hawk";

       prices[1] = 40.50;

       names[2] = "Teleme";

       prices[2] = 17.25;

       System.out.println("We sell " + MAXCHEESE + " kind of Cheese:");

       System.out.println(names[0] + ": $" + prices[0] + " per pound");

       System.out.println(names[1] + ": $" + prices[1] + " per pound");

       System.out.println(names[2] + ": $" + prices[2] + " per pound");

       Random ranGen = new Random(100);

       // error at initialising i

       // i should be from 0 to MAXCHEESE value

       for (int i = 0; i < MAXCHEESE; i++) {

           names[i] = "Cheese Type " + (char) ('A' + i);

           prices[i] = ranGen.nextInt(1000) / 100.0;

           amounts[i] = 0;

           System.out.println(names[i] + ": $" + prices[i] + " per pound");

       }        

   }

}

7 0
4 years ago
What is the criteria for a guard having to be used on a machine?
evablogger [386]

Answer:

Machine Safeguards must meet these minimum general requirements: Prevent contact: The safeguard must prevent hands, arms, or any other part of a worker's body from making contact with dangerous moving parts. Be secure: Workers should not be able to easily remove or tamper with the safeguard.

8 0
3 years ago
1. A 260 ft (79.25 m) length of size 4 AWG uncoated copper wire operating at a tem-
Murljashka [212]

A 260 ft (79.25m) length of size 4 AWG uncoated copper wire operating at a temperature of 75°c has a resistance of 0.0792 ohm.

Explanation:

From the given data the area of size 4 AWG of the code is 21.2 mm², then K is the Resistivity of the material at 75°c is taken as ( 0.0214 ohm mm²/m ).

To find the resistance of 260 ft (79.25 m) of size 4 AWG,

R= K * L/ A

K = 0.0214 ohm mm²/m

L = 79.25 m

A = 21.2 mm²

R = 0.0214 * \frac{79.25}{21.2}

  = 0.0214 * 3.738

  = 0.0792 ohm.

Thus the resistance of uncoated copper wire is 0.0792 ohm

5 0
3 years ago
How is the fuel introduced into the Diesel engine?
Ugo [173]

Answer:

diesel fuel is pumped at high pressure to the injectors which are responsible for entering the fuel into the combustion chamber,

when the piston is at the top the pressure is so high that it explodes the fuel (diesel) that results in a generation of mechanical power

5 0
3 years ago
A good rule of thumb in hazardous conditions is to _____.
Aloiza [94]

Answer:

C. Have your hazard lights on

Explanation:

Speeding up will cause an accident

Counter steering is not easy to do

Slowing down my result in you being rear ended

5 0
3 years ago
Read 2 more answers
Other questions:
  • 5. Which of these least accurately describes what happens when abnormal combustion raises the temperature and pressure inside th
    8·1 answer
  • If you know that the change in entropy of a system where heat was added is 12 J/K, and that the temperature of the system is 250
    10·1 answer
  • Give two methods on how powder is produced in powder metallurgy.
    5·2 answers
  • Consider a steady-state experiment in which the observed current due to reduction of Ox to R is 85 mA/cm2. What is the concentra
    12·1 answer
  • Create an array of 10 size and assign 10 random numbers. Now find the sum of the array using for and while loop.
    6·1 answer
  • Technician A says that squeeze-type resistance spot welding (STRSW) may be used on open butt joints. Technician B says that repl
    14·1 answer
  • BIG POINTS AND WILL GIVE BRAINLIEST! Answer all 5 please or I can’t give brainliest and might report!
    10·1 answer
  • Which of the following is an example of a computer simulation?
    7·1 answer
  • Witch one is cuter compared to ur opinion calico kitten or grey?​
    5·1 answer
  • John has an exhaust leak in his Acura Integra GS-R, What steps would he take to fix the leak in time for his inspection?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!