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
What can your employer do to protect you from overhead power lines?
agasfer [191]

Answer:

Have the power company install insulated sleeves (also known as “eels”) over power lines.​

Wearing PPE is the only way to prevent being electrocuted

Explanation:

To prevent electrocution at workplace, employers can ensure that the  power company install insulated sleeves (also known as “eels”) over power lines.​ Additionally, the employees should wear PPEs which are insulators to prevent electrocution.

5 0
3 years ago
Technician A says that 5W-30 would be better to use than 20W-50 in most vehicles in
shtirl [24]
Technician is correct sorry if im wronghg
5 0
3 years ago
Read 2 more answers
All air-conditioning units must be grounded electrically to
Tpy6a [65]

Answer:

Prevent electrical shock

Grounding is a non current carrying conductor mainly used to guard against hazards due to leakage in electric circuits

Explanation:

The grounding refers to the connection of an electrical equipment exposed metallic parts to the ground to serve as a source of current flow in the event of an insulation failure will cause the fuses to trip thereby isolating or removing electric power from the device

Grounding also prevents the accumulation of static electricity which can be a source of fire in inflammable areas.

8 0
3 years ago
The operating sequence to light the main burners on an intermittent pilot system is:______.
11111nata11111 [884]
The pilot valve and spark igniter are energized, the pilot flame is proved, and then the main gas valve is energized.
7 0
2 years ago
The oil system is:
kirill [66]

Answer:

From the main bearings, the oil passes through feed-holes into drilled passages in the crankshaft and on to the big-end bearings of the connecting rod.

3 0
2 years ago
Other questions:
  • . A storm sewer is carrying snow melt containing 1.200 g/L of sodium chloride into a small stream. The stream has a naturally oc
    8·1 answer
  • What is a thermal reservoir?
    15·1 answer
  • All welding processes that take place without melting of the work pieces. a)- True b)-False
    15·1 answer
  • 2 definiciones de personas en Técnicos en ingeniería eléctrica y agregar link.<br> Por favor❗❗❗
    13·1 answer
  • 1. You are asked to write a report about one of the structures that Transportation Engineers
    9·1 answer
  • Running ropes must be taken out of service if they have _____ broken wires in one strad in one lay
    15·2 answers
  • For a bolted assembly with eight bolts, the stiffness of each bolt is kb = 1.0 MN/mm and the stiffness of the members is km = 2.
    14·1 answer
  • (a) calculate the moment at point "c", where point "c" is the square 3'' below the centroid
    13·1 answer
  • A __________ defines the area of land that will supply water to a stream.
    9·1 answer
  • In a wheatstone bridge three out of four resistors have of 1K ohm each ,and the fourth resistor equals 1010 ohm. If the battery
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!