を考え出す:私は今、約2週間の学校でJavaを学習されているが、私はこれをアプローチする方法がわからないよ型パラメータ
// Represents a card used to purchase food services at a university
public class FoodServicesCard {
// points needed to get cash-back reward
public static int POINTS_NEEDED_FOR_CASH_BACK = 2000;
// points earned for each cent charged to card
public static int REWARD_POINTS_PER_CENT_CHARGED = 1;
// reward in cents
public static int CASH_BACK_REWARD = 10;
// add fields to represent changing properties of a food services card
//####################################################################
// -> here is where I start coding, however, I'm uncertain where to start.
}
私は考えることができる唯一の1がint型ですが、カードが2つのintから構成されているようです:報酬ポイントと現金残高。 2つの整数をグループ化して、このような形にまとめることができるものがあるかどうかはわかりません。多分int reward_pt、int cash_remain; intを使用してフードサービスカードの構造を表します。
誰も私にこのヒントを教えてもらえますか?事前に感謝の意を表します。
複数の変数をまとめてグループ化するのは、クラスとオブジェクトのポイントです。したがって、あなたの質問は私には少し不明です。なぜあなたのソリューションは "int reward_pt; int cash_remain;' "not working? – Beethoven