1923: Sorting Books

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:18 解决:11

题目描述

Define a book class which consists of three non-static data fields ,including "bookName"(the name of a book), "bookPrice"(the price of a book),and "bookNums"(the number of a book)

输入

There are many cases , and for each case ,the first line is to input a integer n  to denote the number of books,and a character 'A' or 'D' to denote a sorting in ascending order and descending order of age.

 then input n books, including a book's name,a book's price, and the number of book.

输出

Output the information of all books in an ascending order of book' price

样例输入 复制

4 A
Flipped 79.8 20
Pride 49.8 2
living 35.0 2
happiness 69.0 1
4 D
Flipped 79.8 20
Pride 49.8 2
living 35.0 2
happiness 69.0 1

样例输出 复制

books in ascending price are:
living 35.0¥ 2
Pride 49.8¥ 2
happiness 69.0¥ 1
Flipped 79.8¥ 20
books in descending price are:
Flipped 79.8¥ 20
happiness 69.0¥ 1
Pride 49.8¥ 2
living 35.0¥ 2