Starting from:

$25

CS18000 Homework 01: Business Card Solved

As you are going to learn, the concept of type is a very important part of many programming languages. Variables are also an important part, and must be declared with a specific type in Java. A variable can be thought of as a box, and the type of a variable can be thought of a label on the box — making sure that it can only hold contents of that particular type.

 

In Java, there are eight primitive types to choose from — ​byte​, ​char​, ​short​, ​int​, ​long​, ​float​, double, and ​ boolean​         . ​ int​    , for instance, can hold whole numbers like ​ 42​      , ​ 1000​ , or ​     5679​   . Another​ type, ​double​, can hold floating point numbers like ​3.14​, ​2.72​, or ​1.414​. The type ​String ​is a little different, and you will learn this later on in the course. All you need to know now, though, is that a variable of type ​String ​can be use to hold text in double quotes, such as ​“Hello, world!” or ​“CS18000”​. Your job below, is to implement a program to prompt a student for some information, then display it in a business card format. Doing so will introduce you to the types int​, ​double​, and ​String​.

 

Description:

 

Write a program that prompts a student, using ​Scanner, for their name (a ​ String​  )​ , age (an int​  )​ , GPA (a ​double​), major (a ​String​), and email (a ​String​).

 

The information should then be displayed in the business card format shown on the example output, which is located on the next page.

 

Example output:

 

More products